<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>vim_faq - Vim Documentation</title>
<meta name="Generator" content="Vim/8.0">
<meta name="plugin-version" content="vim8.0">
<meta name="syntax" content="help">
<meta name="settings" content="no_pre,use_css,expand_tabs">
<link rel="stylesheet" href="style.css" type="text/css" />

<script src="jquery.min.js" type="text/javascript"></script>
<script src="mark-current-page.js" type="text/javascript"></script>
</head>

<body>

<header>

<div class="header">
  <a href="http://vim-jp.org/">vim-jp</a>
  / <a href="http://vim-jp.org/vimdoc-en/">vimdoc-en</a>
  / vim_faq<br />
  <a name="top"></a><h1>vim_faq - Vim Documentation</h1>
  <a href="index.html">Return to main</a>

  <span class="EnglishJapaneseLink">
    <span class="CurrentLanguage">English</span>
  </span>
</div>
</header>

<nav>
<dl>

<dt>BASIC</dt>
<dd><ul>
<li><a href="quickref.html">quickref</a></li>
<li><a href="sponsor.html">sponsor</a></li>
</ul></dd>

<dt>USER MANUAL</dt>
<dd><ul>
<li><a href="usr_toc.html">usr_toc</a></li>
</ul></dd>

<dt>Getting Started</dt>
<dd><ul>
<li><a href="usr_01.html">usr_01</a></li>
<li><a href="usr_02.html">usr_02</a></li>
<li><a href="usr_03.html">usr_03</a></li>
<li><a href="usr_04.html">usr_04</a></li>
<li><a href="usr_05.html">usr_05</a></li>
<li><a href="usr_06.html">usr_06</a></li>
<li><a href="usr_07.html">usr_07</a></li>
<li><a href="usr_08.html">usr_08</a></li>
<li><a href="usr_09.html">usr_09</a></li>
<li><a href="usr_10.html">usr_10</a></li>
<li><a href="usr_11.html">usr_11</a></li>
<li><a href="usr_12.html">usr_12</a></li>
</ul></dd>

<dt>Editing Effectively</dt>
<dd><ul>
<li><a href="usr_20.html">usr_20</a></li>
<li><a href="usr_21.html">usr_21</a></li>
<li><a href="usr_22.html">usr_22</a></li>
<li><a href="usr_23.html">usr_23</a></li>
<li><a href="usr_24.html">usr_24</a></li>
<li><a href="usr_25.html">usr_25</a></li>
<li><a href="usr_26.html">usr_26</a></li>
<li><a href="usr_27.html">usr_27</a></li>
<li><a href="usr_28.html">usr_28</a></li>
<li><a href="usr_29.html">usr_29</a></li>
<li><a href="usr_30.html">usr_30</a></li>
<li><a href="usr_31.html">usr_31</a></li>
<li><a href="usr_32.html">usr_32</a></li>
</ul></dd>

<dt>Tuning Vim</dt>
<dd><ul>
<li><a href="usr_40.html">usr_40</a></li>
<li><a href="usr_41.html">usr_41</a></li>
<li><a href="usr_42.html">usr_42</a></li>
<li><a href="usr_43.html">usr_43</a></li>
<li><a href="usr_44.html">usr_44</a></li>
<li><a href="usr_45.html">usr_45</a></li>
</ul></dd>

<dt>Making Vim Run</dt>
<dd><ul>
<li><a href="usr_90.html">usr_90</a></li>
</ul></dd>

<dt>General subjects</dt>
<dd><ul>
<li><a href="intro.html">intro</a></li>
<li><a href="index.html">help</a></li>
<li><a href="helphelp.html">helphelp</a></li>
<li><a href="vimindex.html">index</a></li>
<li><a href="tags.html">tags</a></li>
<li><a href="howto.html">howto</a></li>
<li><a href="tips.html">tips</a></li>
<li><a href="message.html">message</a></li>
<li><a href="quotes.html">quotes</a></li>
<li><a href="todo.html">todo</a></li>
<li><a href="debug.html">debug</a></li>
<li><a href="develop.html">develop</a></li>
<li><a href="uganda.html">uganda</a></li>
</ul></dd>

<dt>Basic editing</dt>
<dd><ul>
<li><a href="starting.html">starting</a></li>
<li><a href="editing.html">editing</a></li>
<li><a href="motion.html">motion</a></li>
<li><a href="scroll.html">scroll</a></li>
<li><a href="insert.html">insert</a></li>
<li><a href="change.html">change</a></li>
<li><a href="indent.html">indent</a></li>
<li><a href="undo.html">undo</a></li>
<li><a href="repeat.html">repeat</a></li>
<li><a href="visual.html">visual</a></li>
<li><a href="various.html">various</a></li>
<li><a href="recover.html">recover</a></li>
</ul></dd>

<dt>Advanced editing</dt>
<dd><ul>
<li><a href="cmdline.html">cmdline</a></li>
<li><a href="options.html">options</a></li>
<li><a href="pattern.html">pattern</a></li>
<li><a href="map.html">map</a></li>
<li><a href="tagsrch.html">tagsrch</a></li>
<li><a href="quickfix.html">quickfix</a></li>
<li><a href="windows.html">windows</a></li>
<li><a href="tabpage.html">tabpage</a></li>
<li><a href="syntax.html">syntax</a></li>
<li><a href="spell.html">spell</a></li>
<li><a href="diff.html">diff</a></li>
<li><a href="autocmd.html">autocmd</a></li>
<li><a href="filetype.html">filetype</a></li>
<li><a href="eval.html">eval</a></li>
<li><a href="channel.html">channel</a></li>
<li><a href="fold.html">fold</a></li>
</ul></dd>

<dt>Special issues</dt>
<dd><ul>
<li><a href="print.html">print</a></li>
<li><a href="remote.html">remote</a></li>
<li><a href="term.html">term</a></li>
<li><a href="digraph.html">digraph</a></li>
<li><a href="mbyte.html">mbyte</a></li>
<li><a href="mlang.html">mlang</a></li>
<li><a href="arabic.html">arabic</a></li>
<li><a href="farsi.html">farsi</a></li>
<li><a href="hebrew.html">hebrew</a></li>
<li><a href="russian.html">russian</a></li>
<li><a href="ft_ada.html">ft_ada</a></li>
<li><a href="ft_sql.html">ft_sql</a></li>
<li><a href="hangulin.html">hangulin</a></li>
<li><a href="rileft.html">rileft</a></li>
</ul></dd>

<dt>GUI</dt>
<dd><ul>
<li><a href="gui.html">gui</a></li>
<li><a href="gui_w32.html">gui_w32</a></li>
<li><a href="gui_x11.html">gui_x11</a></li>
</ul></dd>

<dt>Interfaces</dt>
<dd><ul>
<li><a href="if_cscop.html">if_cscop</a></li>
<li><a href="if_lua.html">if_lua</a></li>
<li><a href="if_mzsch.html">if_mzsch</a></li>
<li><a href="if_perl.html">if_perl</a></li>
<li><a href="if_pyth.html">if_pyth</a></li>
<li><a href="if_tcl.html">if_tcl</a></li>
<li><a href="if_ole.html">if_ole</a></li>
<li><a href="if_ruby.html">if_ruby</a></li>
<li><a href="debugger.html">debugger</a></li>
<li><a href="workshop.html">workshop</a></li>
<li><a href="netbeans.html">netbeans</a></li>
<li><a href="sign.html">sign</a></li>
</ul></dd>

<dt>Versions</dt>
<dd><ul>
<li><a href="vi_diff.html">vi_diff</a></li>
<li><a href="version4.html">version4</a></li>
<li><a href="version5.html">version5</a></li>
<li><a href="version6.html">version6</a></li>
<li><a href="version7.html">version7</a></li>
<li><a href="version8.html">version8</a></li>
</ul></dd>

<dt>Remarks about specific systems</dt>
<dd><ul>
<li><a href="os_390.html">os_390</a></li>
<li><a href="os_amiga.html">os_amiga</a></li>
<li><a href="os_beos.html">os_beos</a></li>
<li><a href="os_dos.html">os_dos</a></li>
<li><a href="os_mac.html">os_mac</a></li>
<li><a href="os_mint.html">os_mint</a></li>
<li><a href="os_msdos.html">os_msdos</a></li>
<li><a href="os_os2.html">os_os2</a></li>
<li><a href="os_qnx.html">os_qnx</a></li>
<li><a href="os_risc.html">os_risc</a></li>
<li><a href="os_unix.html">os_unix</a></li>
<li><a href="os_vms.html">os_vms</a></li>
<li><a href="os_win32.html">os_win32</a></li>
</ul></dd>

<dt>Standard plugins</dt>
<dd><ul>
<li><a href="pi_getscript.html">pi_getscript</a></li>
<li><a href="pi_gzip.html">pi_gzip</a></li>
<li><a href="pi_logipat.html">pi_logipat</a></li>
<li><a href="pi_netrw.html">pi_netrw</a></li>
<li><a href="pi_paren.html">pi_paren</a></li>
<li><a href="pi_tar.html">pi_tar</a></li>
<li><a href="pi_vimball.html">pi_vimball</a></li>
<li><a href="pi_zip.html">pi_zip</a></li>
</ul></dd>

<dt>Filetype plugins</dt>
<dd><ul>
<li><a href="pi_spec.html">pi_spec</a></li>
</ul></dd>

<dt>Others</dt>
<dd><ul>
<li><a href="vim_faq.html">vim_faq</a></li>
</ul></dd>

</dl>
</nav>

<article class="Vimdoc VimdocJa">
<div id='vimCodeElement'>
<a class="Constant" href="vim_faq.html" name="vim_faq.txt">vim_faq.txt</a>&nbsp;&nbsp; Frequently Asked Questions<br>
<br>
Last updated on: 04 August 2016<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VIM FAQ by: Christian Brabandt &lt;cb@256bit.org&gt;<br>
<br>
Frequently Asked Questions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="vim_faq.html#vim-faq" name="vim-faq">vim-faq</a>&nbsp;<a class="Constant" href="vim_faq.html#Vim-FAQ" name="Vim-FAQ">Vim-FAQ</a><br>
<br>
This Vim FAQ is created from the questions and answers posted to the<br>
vim@vim.org user mailing list and the comp.editors newsgroup. There are<br>
several ways to solve a problem in Vim. This FAQ gives one of those several<br>
possibilities. You can explore the other ways using the information and<br>
links given in this FAQ. The credit for the answers in this FAQ goes to<br>
Peppe, Benji, Charles Campbell and numerous others. An online version of<br>
this FAQ is available at&nbsp;<span class="Constant"><a href="http://vimhelp.appspot.com/vim_faq.txt.html">http://vimhelp.appspot.com/vim_faq.txt.html</a></span><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="vim_faq.html#faq-index" name="faq-index">faq-index</a><br>
INDEX<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-general-information" name="faq-general-information">faq-general-information</a><br>
SECTION 1 - GENERAL INFORMATION<br>
<a class="Identifier" href="vim_faq.html#faq-1.1">faq-1.1</a>&nbsp;&nbsp; What is Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-1.2">faq-1.2</a>&nbsp;&nbsp; Who wrote Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-1.3">faq-1.3</a>&nbsp;&nbsp; Is Vim compatible with Vi?<br>
<a class="Identifier" href="vim_faq.html#faq-1.4">faq-1.4</a>&nbsp;&nbsp; What are some of the improvements of Vim over Vi?<br>
<a class="Identifier" href="vim_faq.html#faq-1.5">faq-1.5</a>&nbsp;&nbsp; Is Vim free?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-resources" name="faq-resources">faq-resources</a><br>
SECTION 2 - RESOURCES<br>
<a class="Identifier" href="vim_faq.html#faq-2.1">faq-2.1</a>&nbsp;&nbsp; Where can I learn more about Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-2.2">faq-2.2</a>&nbsp;&nbsp; Is there a mailing list available?<br>
<a class="Identifier" href="vim_faq.html#faq-2.3">faq-2.3</a>&nbsp;&nbsp; Is there an archive available for the Vim mailing lists?<br>
<a class="Identifier" href="vim_faq.html#faq-2.4">faq-2.4</a>&nbsp;&nbsp; Where can I get the Vim user manual in HTML/PDF/PS format?<br>
<a class="Identifier" href="vim_faq.html#faq-2.5">faq-2.5</a>&nbsp;&nbsp; I have a &quot;xyz&quot; (some) problem with Vim. How do I determine if it is a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;problem with my setup or with Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-2.6">faq-2.6</a>&nbsp;&nbsp; Where can I report bugs?<br>
<a class="Identifier" href="vim_faq.html#faq-2.7">faq-2.7</a>&nbsp;&nbsp; Where can the FAQ be found?<br>
<a class="Identifier" href="vim_faq.html#faq-2.8">faq-2.8</a>&nbsp;&nbsp; What if I don't find an answer in this FAQ?<br>
<a class="Identifier" href="vim_faq.html#faq-2.9">faq-2.9</a>&nbsp;&nbsp; I have a patch for implementing a Vim feature. Where do I send the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;patch?<br>
<a class="Identifier" href="vim_faq.html#faq-2.10">faq-2.10</a>&nbsp;&nbsp;I have a Vim tip or developed a new Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;syntax/indent/filetype/compiler plugin or developed a new script<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or a colorscheme. Is there a public website where I can upload<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-availability" name="faq-availability">faq-availability</a><br>
SECTION 3 - AVAILABILITY<br>
<a class="Identifier" href="vim_faq.html#faq-3.1">faq-3.1</a>&nbsp;&nbsp; What is the latest version of Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-3.2">faq-3.2</a>&nbsp;&nbsp; Where can I find the latest version of Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-3.3">faq-3.3</a>&nbsp;&nbsp; What platforms does it run on?<br>
<a class="Identifier" href="vim_faq.html#faq-3.4">faq-3.4</a>&nbsp;&nbsp; Where can I download the latest version of the Vim runtime files?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-help" name="faq-help">faq-help</a><br>
SECTION 4 - HELP<br>
<a class="Identifier" href="vim_faq.html#faq-4.1">faq-4.1</a>&nbsp;&nbsp; How do I use the help files?<br>
<a class="Identifier" href="vim_faq.html#faq-4.2">faq-4.2</a>&nbsp;&nbsp; How do I search for a keyword in the Vim help files?<br>
<a class="Identifier" href="vim_faq.html#faq-4.3">faq-4.3</a>&nbsp;&nbsp; I am getting an error message E123, what did I do wrong?<br>
<a class="Identifier" href="vim_faq.html#faq-4.4">faq-4.4</a>&nbsp;&nbsp; Where can I read about the various modes in Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-4.5">faq-4.5</a>&nbsp;&nbsp; How do I generate the Vim help tags file after adding a new Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;help file?<br>
<a class="Identifier" href="vim_faq.html#faq-4.6">faq-4.6</a>&nbsp;&nbsp; Can I use compressed versions of the help files?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-editing-a-file" name="faq-editing-a-file">faq-editing-a-file</a><br>
SECTION 5 - EDITING A FILE<br>
<a class="Identifier" href="vim_faq.html#faq-5.1">faq-5.1</a>&nbsp;&nbsp; How do I load a file in Vim for editing?<br>
<a class="Identifier" href="vim_faq.html#faq-5.2">faq-5.2</a>&nbsp;&nbsp; How do I save the current file in another name (save as) and edit<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a new file?<br>
<a class="Identifier" href="vim_faq.html#faq-5.3">faq-5.3</a>&nbsp;&nbsp; How do I change the current directory to the directory of the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;current file?<br>
<a class="Identifier" href="vim_faq.html#faq-5.4">faq-5.4</a>&nbsp;&nbsp; How do I write a file without the line feed (EOL) at the end of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the file?<br>
<a class="Identifier" href="vim_faq.html#faq-5.5">faq-5.5</a>&nbsp;&nbsp; How do I configure Vim to open a file at the last edited location?<br>
<a class="Identifier" href="vim_faq.html#faq-5.6">faq-5.6</a>&nbsp;&nbsp; When editing a file in Vim, which is being changed by an external<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application, Vim opens a warning window (like the confirm dialog)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;each time a change is detected. How do I disable this warning?<br>
<a class="Identifier" href="vim_faq.html#faq-5.7">faq-5.7</a>&nbsp;&nbsp; How do I edit a file whose name is under the cursor?<br>
<a class="Identifier" href="vim_faq.html#faq-5.8">faq-5.8</a>&nbsp;&nbsp; How do I reload/re-edit the current file?<br>
<a class="Identifier" href="vim_faq.html#faq-5.9">faq-5.9</a>&nbsp;&nbsp; How do I autosave a file periodically?<br>
<a class="Identifier" href="vim_faq.html#faq-5.10">faq-5.10</a>&nbsp;&nbsp;How do I open a file in read-only mode?<br>
<a class="Identifier" href="vim_faq.html#faq-5.11">faq-5.11</a>&nbsp;&nbsp;How do I open a file for editing without saving the modifications<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to the current file?<br>
<a class="Identifier" href="vim_faq.html#faq-5.12">faq-5.12</a>&nbsp;&nbsp;How do I reduce the loading time for very large files in Vim?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-editing-multiple-files" name="faq-editing-multiple-files">faq-editing-multiple-files</a><br>
SECTION 6 - EDITING MULTIPLE FILES<br>
<a class="Identifier" href="vim_faq.html#faq-6.1">faq-6.1</a>&nbsp;&nbsp; How do I open multiple files at once from within Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-6.2">faq-6.2</a>&nbsp;&nbsp; How do I switch between multiple files/buffers in Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-6.3">faq-6.3</a>&nbsp;&nbsp; How do I open several files in Vim, with each file in a separate<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window/tabpage?<br>
<a class="Identifier" href="vim_faq.html#faq-6.4">faq-6.4</a>&nbsp;&nbsp; How do I configure Vim to autoload several files at once similar<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to &quot;work-sets&quot; or &quot;projects&quot;?<br>
<a class="Identifier" href="vim_faq.html#faq-6.5">faq-6.5</a>&nbsp;&nbsp; Is it possible to open multiple top level windows in a single<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;instance of Vim similar to Nedit or emacs?<br>
<a class="Identifier" href="vim_faq.html#faq-6.6">faq-6.6</a>&nbsp;&nbsp; How do I browse/explore directories from within Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-6.7">faq-6.7</a>&nbsp;&nbsp; How do I edit files over a network using ftp/scp/rcp/http?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-backup" name="faq-backup">faq-backup</a><br>
SECTION 7 - BACKUP<br>
<a class="Identifier" href="vim_faq.html#faq-7.1">faq-7.1</a>&nbsp;&nbsp; When I edit and save files, Vim creates a file with the same name<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as the original file and a &quot;~&quot; character at the end. How do I stop<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim from creating this file (or) How do I disable the Vim backup<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file feature?<br>
<a class="Identifier" href="vim_faq.html#faq-7.2">faq-7.2</a>&nbsp;&nbsp; When I edit and save files, Vim creates a file with the same name<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;as the original file and a &quot;.un~&quot; extension at the end. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stop Vim from creating this file (or) How do I disable the Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;undofile feature.<br>
<a class="Identifier" href="vim_faq.html#faq-7.3">faq-7.3</a>&nbsp;&nbsp; How do I configure Vim to store all the backup files in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particular directory?<br>
<a class="Identifier" href="vim_faq.html#faq-7.4">faq-7.4</a>&nbsp;&nbsp; When I save a file with Vim, the file permissions are changed.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;How do I configure Vim to save a file without changing the file<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;permissions?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-buffers" name="faq-buffers">faq-buffers</a><br>
SECTION 8 - BUFFERS<br>
<a class="Identifier" href="vim_faq.html#faq-8.1">faq-8.1</a>&nbsp;&nbsp; I have made some modifications to a buffer. How do I edit another<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer without saving the modified buffer and also without losing<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the modifications?<br>
<a class="Identifier" href="vim_faq.html#faq-8.2">faq-8.2</a>&nbsp;&nbsp; How do I configure Vim to auto-save a modified buffer when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switching to another buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-8.3">faq-8.3</a>&nbsp;&nbsp; How do I replace the buffer in the current window with a blank<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-8.4">faq-8.4</a>&nbsp;&nbsp; Is there a keyboard shortcut to load a buffer by the buffer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;number?<br>
<a class="Identifier" href="vim_faq.html#faq-8.5">faq-8.5</a>&nbsp;&nbsp; How do I open all the current buffers in separate windows?<br>
<a class="Identifier" href="vim_faq.html#faq-8.6">faq-8.6</a>&nbsp;&nbsp; How do I close (delete) a buffer without exiting Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-8.7">faq-8.7</a>&nbsp;&nbsp; When I use the command &quot;:%bd&quot; to delete all the buffers, not all<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the buffers are deleted. Why?<br>
<a class="Identifier" href="vim_faq.html#faq-8.8">faq-8.8</a>&nbsp;&nbsp; How do I display the buffer number of the current buffer/file?<br>
<a class="Identifier" href="vim_faq.html#faq-8.9">faq-8.9</a>&nbsp;&nbsp; How do I delete a buffer without closing the window in which the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer is displayed?<br>
<a class="Identifier" href="vim_faq.html#faq-8.10">faq-8.10</a>&nbsp;&nbsp;How do I map the tab key to cycle through and open all the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffers?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-windows" name="faq-windows">faq-windows</a><br>
SECTION 9 - WINDOWS<br>
<a class="Identifier" href="vim_faq.html#faq-9.1">faq-9.1</a>&nbsp;&nbsp; What is the difference between a Vim window and a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-9.2">faq-9.2</a>&nbsp;&nbsp; How do I increase the width of a Vim window?<br>
<a class="Identifier" href="vim_faq.html#faq-9.3">faq-9.3</a>&nbsp;&nbsp; How do I zoom into or out of a window?<br>
<a class="Identifier" href="vim_faq.html#faq-9.4">faq-9.4</a>&nbsp;&nbsp; How do I execute an ex command on all the open buffers or open<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;windows or all the files in the argument list?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-motion" name="faq-motion">faq-motion</a><br>
SECTION 10 - MOTION<br>
<a class="Identifier" href="vim_faq.html#faq-10.1">faq-10.1</a>&nbsp;&nbsp;How do I jump to the beginning (first line) or end (last line) of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a file?<br>
<a class="Identifier" href="vim_faq.html#faq-10.2">faq-10.2</a>&nbsp;&nbsp;In insert mode, when I press the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key to go to command mode,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the cursor moves one character to the left (except when the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cursor is on the first character of the line). Is it possible to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;change this behavior to keep the cursor at the same column?<br>
<a class="Identifier" href="vim_faq.html#faq-10.3">faq-10.3</a>&nbsp;&nbsp;How do I configure Vim to maintain the horizontal cursor position<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when scrolling with the &lt;Page Up&gt;, &lt;Page Down&gt;, etc keys?<br>
<a class="Identifier" href="vim_faq.html#faq-10.4">faq-10.4</a>&nbsp;&nbsp;Some lines in a file are more than the screen width and they are<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;all wrapped. When I use the j, k keys to move from one line to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the next, the cursor is moved to the next line in the file<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;instead of the next line on the screen. How do I move from one<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;screen line to the next?<br>
<a class="Identifier" href="vim_faq.html#faq-10.5">faq-10.5</a>&nbsp;&nbsp;What is the definition of a sentence, paragraph and section in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-10.6">faq-10.6</a>&nbsp;&nbsp;How do I jump to beginning or end of a sentence, paragraph or a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;section?<br>
<a class="Identifier" href="vim_faq.html#faq-10.7">faq-10.7</a>&nbsp;&nbsp;I have lines in a file that extends beyond the right extent of the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;screen. How do I move the Vim view to the right to see the text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;off the screen?<br>
<a class="Identifier" href="vim_faq.html#faq-10.8">faq-10.8</a>&nbsp;&nbsp;How do I scroll two or more buffers simultaneously?<br>
<a class="Identifier" href="vim_faq.html#faq-10.9">faq-10.9</a>&nbsp;&nbsp;When I use my arrow keys, Vim changes modes, inserts weird<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters in my document but doesn't move the cursor properly.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What's going on?<br>
<a class="Identifier" href="vim_faq.html#faq-10.10">faq-10.10</a>&nbsp;How do I configure Vim to move the cursor to the end of the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;previous line, when the left arrow key is pressed and the cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is currently at the beginning of a line?<br>
<a class="Identifier" href="vim_faq.html#faq-10.11">faq-10.11</a>&nbsp;How do I configure Vim to stay only in insert mode (modeless<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;editing)?<br>
<a class="Identifier" href="vim_faq.html#faq-10.12">faq-10.12</a>&nbsp;How do I display some context lines when scrolling text?<br>
<a class="Identifier" href="vim_faq.html#faq-10.13">faq-10.13</a>&nbsp;How do I go back to previous cursor locations?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-searching-text" name="faq-searching-text">faq-searching-text</a><br>
SECTION 11 - SEARCHING TEXT<br>
<a class="Identifier" href="vim_faq.html#faq-11.1">faq-11.1</a>&nbsp;&nbsp;After I searched for a text with a pattern, all the matched text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stays highlighted. How do I turn off the highlighting<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temporarily/permanently?<br>
<a class="Identifier" href="vim_faq.html#faq-11.2">faq-11.2</a>&nbsp;&nbsp;How do I enter a carriage return character in a search pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-11.3">faq-11.3</a>&nbsp;&nbsp;How do I search for the character ^M?<br>
<a class="Identifier" href="vim_faq.html#faq-11.4">faq-11.4</a>&nbsp;&nbsp;How can I search/replace characters that display as '~R', '~S',<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;etc.?<br>
<a class="Identifier" href="vim_faq.html#faq-11.5">faq-11.5</a>&nbsp;&nbsp;How do I highlight all the non-printable characters in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-11.6">faq-11.6</a>&nbsp;&nbsp;How do I search for whole words in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-11.7">faq-11.7</a>&nbsp;&nbsp;How do I search for the current word under the cursor?<br>
<a class="Identifier" href="vim_faq.html#faq-11.8">faq-11.8</a>&nbsp;&nbsp;How do I search for a word without regard to the case (uppercase<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or lowercase)?<br>
<a class="Identifier" href="vim_faq.html#faq-11.9">faq-11.9</a>&nbsp;&nbsp;How do I search for words that occur twice consecutively?<br>
<a class="Identifier" href="vim_faq.html#faq-11.10">faq-11.10</a>&nbsp;How do I count the number of times a particular word occurs in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-11.11">faq-11.11</a>&nbsp;How do I place the cursor at the end of the matched word when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;searching for a pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-11.12">faq-11.12</a>&nbsp;How do I search for an empty line?<br>
<a class="Identifier" href="vim_faq.html#faq-11.13">faq-11.13</a>&nbsp;How do I search for a line containing only a single character?<br>
<a class="Identifier" href="vim_faq.html#faq-11.14">faq-11.14</a>&nbsp;How do I search and replace a string in multiple files?<br>
<a class="Identifier" href="vim_faq.html#faq-11.15">faq-11.15</a>&nbsp;I am using the &quot;:s&quot; substitute command in a mapping. When a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;search for a pattern fails, the map terminates. I would like the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;map to continue processing the next command, even if the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;substitute command fails. How do I do this?<br>
<a class="Identifier" href="vim_faq.html#faq-11.16">faq-11.16</a>&nbsp;How do I search for the n-th occurrence of a character in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line?<br>
<a class="Identifier" href="vim_faq.html#faq-11.17">faq-11.17</a>&nbsp;How do I replace a tab (or any other character) with a hard<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (newline) character?<br>
<a class="Identifier" href="vim_faq.html#faq-11.18">faq-11.18</a>&nbsp;How do I search for a character by its ASCII value?<br>
<a class="Identifier" href="vim_faq.html#faq-11.19">faq-11.19</a>&nbsp;How do I search for long lines?<br>
<a class="Identifier" href="vim_faq.html#faq-11.20">faq-11.20</a>&nbsp;How do I display all the lines in the current buffer that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contain a specified pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-11.21">faq-11.21</a>&nbsp;How do I search for a text string that spans multiple lines?<br>
<a class="Identifier" href="vim_faq.html#faq-11.22">faq-11.22</a>&nbsp;How do I search for a pattern only within a range of lines<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-11.23">faq-11.23</a>&nbsp;How do I clear the last searched pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-11.24">faq-11.24</a>&nbsp;Why does this pattern 'a.\<span class="Special">{-}</span>p\@!' not match?<br>
<a class="Identifier" href="vim_faq.html#faq-11.25">faq-11.25</a>&nbsp;How can I use '/' within a pattern, without escaping it?<br>
<a class="Identifier" href="vim_faq.html#faq-11.26">faq-11.26</a>&nbsp;How can I operate on a search match?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-changing-text" name="faq-changing-text">faq-changing-text</a><br>
SECTION 12 - CHANGING TEXT<br>
<a class="Identifier" href="vim_faq.html#faq-12.1">faq-12.1</a>&nbsp;&nbsp;How do I delete all the trailing white space characters (SPACE<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and TAB) at the end of all the lines in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-12.2">faq-12.2</a>&nbsp;&nbsp;How do I replace all the occurrences of multiple consecutive<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;space characters to a single space?<br>
<a class="Identifier" href="vim_faq.html#faq-12.3">faq-12.3</a>&nbsp;&nbsp;How do I reduce a range of empty lines into one line only?<br>
<a class="Identifier" href="vim_faq.html#faq-12.4">faq-12.4</a>&nbsp;&nbsp;How do I delete all blank lines in a file? How do I remove all<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the lines containing only space characters?<br>
<a class="Identifier" href="vim_faq.html#faq-12.5">faq-12.5</a>&nbsp;&nbsp;How do I copy/yank the current word?<br>
<a class="Identifier" href="vim_faq.html#faq-12.6">faq-12.6</a>&nbsp;&nbsp;How do I yank text from one position to another position within a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line, without yanking the entire line?<br>
<a class="Identifier" href="vim_faq.html#faq-12.7">faq-12.7</a>&nbsp;&nbsp;When I yank some text into a register, how do I append the text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to the current contents of the register?<br>
<a class="Identifier" href="vim_faq.html#faq-12.8">faq-12.8</a>&nbsp;&nbsp;How do I yank a complete sentence that spans over more than one<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line?<br>
<a class="Identifier" href="vim_faq.html#faq-12.9">faq-12.9</a>&nbsp;&nbsp;How do I yank all the lines containing a pattern into a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-12.10">faq-12.10</a>&nbsp;How do I delete all the lines in a file that do not contain a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-12.11">faq-12.11</a>&nbsp;How do I add a line before each line with &quot;pattern&quot; in it?<br>
<a class="Identifier" href="vim_faq.html#faq-12.12">faq-12.12</a>&nbsp;Is there a way to operate on a line if the previous line<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;contains a particular pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-12.13">faq-12.13</a>&nbsp;How do I execute a command on all the lines containing a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pattern?<br>
<a class="Identifier" href="vim_faq.html#faq-12.14">faq-12.14</a>&nbsp;Can I copy the character above the cursor to the current cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;position?<br>
<a class="Identifier" href="vim_faq.html#faq-12.15">faq-12.15</a>&nbsp;How do I insert a blank line above/below the current line<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;without entering insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-12.16">faq-12.16</a>&nbsp;How do I insert the name of the current file into the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-12.17">faq-12.17</a>&nbsp;How do I insert the contents of a Vim register into the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-12.18">faq-12.18</a>&nbsp;How do I move the cursor past the end of line and insert some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters at some columns after the end of the line?<br>
<a class="Identifier" href="vim_faq.html#faq-12.19">faq-12.19</a>&nbsp;How to replace the word under the cursor (say: junk) with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;foojunkbar&quot; in Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-12.20">faq-12.20</a>&nbsp;How do I replace a particular text in all the files in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory?<br>
<a class="Identifier" href="vim_faq.html#faq-12.21">faq-12.21</a>&nbsp;I have some numbers in a file. How do I increment or decrement<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the numbers in the file?<br>
<a class="Identifier" href="vim_faq.html#faq-12.22">faq-12.22</a>&nbsp;How do I reuse the last used search pattern in a &quot;:substitute&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command?<br>
<a class="Identifier" href="vim_faq.html#faq-12.23">faq-12.23</a>&nbsp;How do I change the case of a string using the &quot;:substitute&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command?<br>
<a class="Identifier" href="vim_faq.html#faq-12.24">faq-12.24</a>&nbsp;How do I enter characters that are not present in the keyboard?<br>
<a class="Identifier" href="vim_faq.html#faq-12.25">faq-12.25</a>&nbsp;Is there a command to remove any or all digraphs?<br>
<a class="Identifier" href="vim_faq.html#faq-12.26">faq-12.26</a>&nbsp;In insert mode, when I press the backspace key, it erases only<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the characters entered in this instance of insert mode. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erase previously entered characters in insert mode using the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;backspace key?<br>
<a class="Identifier" href="vim_faq.html#faq-12.27">faq-12.27</a>&nbsp;I have a file which has lines longer than 72 characters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;terminated with &quot;+&quot; and wrapped to the next line. How can I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quickly join the lines?<br>
<a class="Identifier" href="vim_faq.html#faq-12.28">faq-12.28</a>&nbsp;How do I paste characterwise yanked text into separate lines?<br>
<a class="Identifier" href="vim_faq.html#faq-12.29">faq-12.29</a>&nbsp;How do I change the case (uppercase, lowercase) of a word or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a character or a block of text?<br>
<a class="Identifier" href="vim_faq.html#faq-12.30">faq-12.30</a>&nbsp;How do I enter ASCII characters that are not present in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;keyboard?<br>
<a class="Identifier" href="vim_faq.html#faq-12.31">faq-12.31</a>&nbsp;How do I replace non-printable characters in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-12.32">faq-12.32</a>&nbsp;How do I remove duplicate lines from a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-12.33">faq-12.33</a>&nbsp;How do I prefix all the lines in a file with the corresponding<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line numbers?<br>
<a class="Identifier" href="vim_faq.html#faq-12.34">faq-12.34</a>&nbsp;How do I exchange (swap) two characters or words or lines?<br>
<a class="Identifier" href="vim_faq.html#faq-12.35">faq-12.35</a>&nbsp;How do I change the characters used as word delimiters?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-completion-in-insert-mode" name="faq-completion-in-insert-mode">faq-completion-in-insert-mode</a><br>
SECTION 13 - COMPLETION IN INSERT MODE<br>
<a class="Identifier" href="vim_faq.html#faq-13.1">faq-13.1</a>&nbsp;&nbsp;How do I complete words or lines in insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-13.2">faq-13.2</a>&nbsp;&nbsp;How do I complete file names in insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-13.3">faq-13.3</a>&nbsp;&nbsp;I am using&nbsp;<span class="Special">CTRL-P</span>/<span class="Special">CTRL-N</span>&nbsp;to complete words in insert mode. How do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I complete words that occur after the just completed word?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-text-formatting" name="faq-text-formatting">faq-text-formatting</a><br>
SECTION 14 - TEXT FORMATTING<br>
<a class="Identifier" href="vim_faq.html#faq-14.1">faq-14.1</a>&nbsp;&nbsp;How do I format a text paragraph so that a new line is inserted<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at the end of each wrapped line?<br>
<a class="Identifier" href="vim_faq.html#faq-14.2">faq-14.2</a>&nbsp;&nbsp;How do I format long lines in a file so that each line contains<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;less than 'n' characters?<br>
<a class="Identifier" href="vim_faq.html#faq-14.3">faq-14.3</a>&nbsp;&nbsp;How do I join short lines to the form a paragraph?<br>
<a class="Identifier" href="vim_faq.html#faq-14.4">faq-14.4</a>&nbsp;&nbsp;How do I format bulleted and numbered lists?<br>
<a class="Identifier" href="vim_faq.html#faq-14.5">faq-14.5</a>&nbsp;&nbsp;How do I indent lines in insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-14.6">faq-14.6</a>&nbsp;&nbsp;How do I format/indent an entire file?<br>
<a class="Identifier" href="vim_faq.html#faq-14.7">faq-14.7</a>&nbsp;&nbsp;How do I increase or decrease the indentation of the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line?<br>
<a class="Identifier" href="vim_faq.html#faq-14.8">faq-14.8</a>&nbsp;&nbsp;How do I indent a block/group of lines?<br>
<a class="Identifier" href="vim_faq.html#faq-14.9">faq-14.9</a>&nbsp;&nbsp;When I indent lines using the &gt; or &lt; key, the standard 8-tabstops<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are used instead of the current&nbsp;<a class="Type" href="options.html#'tabstop'">'tabstop'</a>&nbsp;setting. Why?<br>
<a class="Identifier" href="vim_faq.html#faq-14.10">faq-14.10</a>&nbsp;How do I turn off the automatic indentation of text?<br>
<a class="Identifier" href="vim_faq.html#faq-14.11">faq-14.11</a>&nbsp;How do I configure Vim to automatically set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;option to a particular value when I edit mails?<br>
<a class="Identifier" href="vim_faq.html#faq-14.12">faq-14.12</a>&nbsp;Is there a way to make Vim auto-magically break lines?<br>
<a class="Identifier" href="vim_faq.html#faq-14.13">faq-14.13</a>&nbsp;I am seeing a lot of ^M symbols in my file. I tried setting the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'fileformat'">'fileformat'</a>&nbsp;option to&nbsp;<span class="MissingTag">'dos'</span>&nbsp;and then&nbsp;<span class="MissingTag">'unix'</span>&nbsp;and then&nbsp;<span class="MissingTag">'mac'</span>.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;None of these helped. How can I hide these symbols?<br>
<a class="Identifier" href="vim_faq.html#faq-14.14">faq-14.14</a>&nbsp;When I paste some text into a Vim buffer from another<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application, the alignment (indentation) of the new text is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;messed up. How do I fix this?<br>
<a class="Identifier" href="vim_faq.html#faq-14.15">faq-14.15</a>&nbsp;When there is a very long wrapped line (wrap is &quot;on&quot;) and a line<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doesn't fit entirely on the screen it is not displayed at all.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;There are blank lines beginning with '@' symbol instead of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wrapped line. If I scroll the screen to fit the line the '@'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;symbols disappear and the line is displayed again. What Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setting control this behavior?<br>
<a class="Identifier" href="vim_faq.html#faq-14.16">faq-14.16</a>&nbsp;How do I convert all the tab characters in a file to space<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters?<br>
<a class="Identifier" href="vim_faq.html#faq-14.17">faq-14.17</a>&nbsp;What Vim options can I use to edit text that will later go to a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;word processor?<br>
<a class="Identifier" href="vim_faq.html#faq-14.18">faq-14.18</a>&nbsp;How do I join lines without adding or removing any space<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-visual-mode" name="faq-visual-mode">faq-visual-mode</a><br>
SECTION 15 - VISUAL MODE<br>
<a class="Identifier" href="vim_faq.html#faq-15.1">faq-15.1</a>&nbsp;&nbsp;How do I do rectangular block copying?<br>
<a class="Identifier" href="vim_faq.html#faq-15.2">faq-15.2</a>&nbsp;&nbsp;How do I delete or change a column of text in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-15.3">faq-15.3</a>&nbsp;&nbsp;How do I apply an ex-command on a set of visually selected lines?<br>
<a class="Identifier" href="vim_faq.html#faq-15.4">faq-15.4</a>&nbsp;&nbsp;How do I execute an ex command on a column of text selected in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Visual block mode?<br>
<a class="Identifier" href="vim_faq.html#faq-15.5">faq-15.5</a>&nbsp;&nbsp;How do I select the entire file in visual mode?<br>
<a class="Identifier" href="vim_faq.html#faq-15.6">faq-15.6</a>&nbsp;&nbsp;When I visually select a set of lines and press the &gt; key to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indent the selected lines, the visual mode ends. How can I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reselect the region for further operation?&nbsp;&nbsp;(or) How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;re-select the last selected visual area again?<br>
<a class="Identifier" href="vim_faq.html#faq-15.7">faq-15.7</a>&nbsp;&nbsp;How do I jump to the beginning/end of a visually selected region?<br>
<a class="Identifier" href="vim_faq.html#faq-15.8">faq-15.8</a>&nbsp;&nbsp;When I select text with mouse and then press : to enter an ex<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command, the selected text is replaced with the : character. How<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do I execute an ex command on a text selected using the mouse<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;similar to the text selected using the visual mode?<br>
<a class="Identifier" href="vim_faq.html#faq-15.9">faq-15.9</a>&nbsp;&nbsp;When I select a block of text using the mouse, Vim goes into<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selection mode instead of Visual mode. Why?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-command-line-mode" name="faq-command-line-mode">faq-command-line-mode</a><br>
SECTION 16 - COMMAND-LINE MODE<br>
<a class="Identifier" href="vim_faq.html#faq-16.1">faq-16.1</a>&nbsp;&nbsp;How do I use the name of the current file in the command mode or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an ex command line?<br>
<a class="Identifier" href="vim_faq.html#faq-16.2">faq-16.2</a>&nbsp;&nbsp;How do I edit the text in the Vim command-line effectively?<br>
<a class="Identifier" href="vim_faq.html#faq-16.3">faq-16.3</a>&nbsp;&nbsp;How do I switch from Vi mode to Ex mode?<br>
<a class="Identifier" href="vim_faq.html#faq-16.4">faq-16.4</a>&nbsp;&nbsp;How do I copy the output from an ex-command into a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-16.5">faq-16.5</a>&nbsp;&nbsp;When I press the tab key to complete the name of a file in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command mode, if there are more than one matching file names,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;then Vim completes the first matching file name and displays a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list of all matching filenames. How do I configure Vim to only<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;display the list of all the matching filenames and not complete<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the first one?<br>
<a class="Identifier" href="vim_faq.html#faq-16.6">faq-16.6</a>&nbsp;&nbsp;How do I copy text from a buffer to the command line and from the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command line to a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-16.7">faq-16.7</a>&nbsp;&nbsp;How do I put a command onto the command history without executing<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;it?<br>
<a class="Identifier" href="vim_faq.html#faq-16.8">faq-16.8</a>&nbsp;&nbsp;How do I increase the height of the command-line?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-viminfo" name="faq-viminfo">faq-viminfo</a><br>
SECTION 17 - VIMINFO<br>
<a class="Identifier" href="vim_faq.html#faq-17.1">faq-17.1</a>&nbsp;&nbsp;When I invoke Vim, I get error messages about illegal characters<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in the viminfo file. What should I do to get rid of these<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;messages?<br>
<a class="Identifier" href="vim_faq.html#faq-17.2">faq-17.2</a>&nbsp;&nbsp;How do I disable the viminfo feature?<br>
<a class="Identifier" href="vim_faq.html#faq-17.3">faq-17.3</a>&nbsp;&nbsp;How do I save and use Vim marks/commands across Vim sessions?&nbsp;<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-remote-editing" name="faq-remote-editing">faq-remote-editing</a><br>
SECTION 18 - REMOTE EDITING<br>
<a class="Identifier" href="vim_faq.html#faq-18.1">faq-18.1</a>&nbsp;&nbsp;How do I open a file with existing instance of gvim? What<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;happened to the Vim 5.x OpenWithVim.exe and SendToVim.exe files?<br>
<a class="Identifier" href="vim_faq.html#faq-18.2">faq-18.2</a>&nbsp;&nbsp;How do I send a command to a Vim server to write all buffers to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disk?<br>
<a class="Identifier" href="vim_faq.html#faq-18.3">faq-18.3</a>&nbsp;&nbsp;Where can I get the documentation about the Vim remote server<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;functionality?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-options" name="faq-options">faq-options</a><br>
SECTION 19 - OPTIONS<br>
<a class="Identifier" href="vim_faq.html#faq-19.1">faq-19.1</a>&nbsp;&nbsp;How do I configure Vim in a simple way?<br>
<a class="Identifier" href="vim_faq.html#faq-19.2">faq-19.2</a>&nbsp;&nbsp;How do I toggle the value of an option?<br>
<a class="Identifier" href="vim_faq.html#faq-19.3">faq-19.3</a>&nbsp;&nbsp;How do I set an option that affects only the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer/window?<br>
<a class="Identifier" href="vim_faq.html#faq-19.4">faq-19.4</a>&nbsp;&nbsp;How do I use space characters for a Vim option value?<br>
<a class="Identifier" href="vim_faq.html#faq-19.5">faq-19.5</a>&nbsp;&nbsp;Can I add (embed) Vim option settings to the contents of a file?<br>
<a class="Identifier" href="vim_faq.html#faq-19.6">faq-19.6</a>&nbsp;&nbsp;How do I display the line numbers of all the lines in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-19.7">faq-19.7</a>&nbsp;&nbsp;How do I change the width of the line numbers displayed using the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot; option?<br>
<a class="Identifier" href="vim_faq.html#faq-19.8">faq-19.8</a>&nbsp;&nbsp;How do I display (view) all the invisible characters like space,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tabs and newlines in a file?<br>
<a class="Identifier" href="vim_faq.html#faq-19.9">faq-19.9</a>&nbsp;&nbsp;How do I configure Vim to always display the current line and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;column number?<br>
<a class="Identifier" href="vim_faq.html#faq-19.10">faq-19.10</a>&nbsp;How do I display the current Vim mode?<br>
<a class="Identifier" href="vim_faq.html#faq-19.11">faq-19.11</a>&nbsp;How do I configure Vim to show pending/partial commands on the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;status line?<br>
<a class="Identifier" href="vim_faq.html#faq-19.12">faq-19.12</a>&nbsp;How do I configure the Vim status line to display different<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;settings/values?<br>
<a class="Identifier" href="vim_faq.html#faq-19.13">faq-19.13</a>&nbsp;How do I configure Vim to display status line always?<br>
<a class="Identifier" href="vim_faq.html#faq-19.14">faq-19.14</a>&nbsp;How do I make a Vim setting persistent across different Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invocations/instances/sessions?<br>
<a class="Identifier" href="vim_faq.html#faq-19.15">faq-19.15</a>&nbsp;Why do I hear a beep (why does my window flash) about 1 second<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;after I hit the Escape key?<br>
<a class="Identifier" href="vim_faq.html#faq-19.16">faq-19.16</a>&nbsp;How do I make the 'c' and 's' commands display a '$' instead of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;deleting the characters I'm changing?<br>
<a class="Identifier" href="vim_faq.html#faq-19.17">faq-19.17</a>&nbsp;How do I remove more than one flag using a single &quot;:set&quot; command<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from a Vim option?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-mapping-keys" name="faq-mapping-keys">faq-mapping-keys</a><br>
SECTION 20 - MAPPING KEYS<br>
<a class="Identifier" href="vim_faq.html#faq-20.1">faq-20.1</a>&nbsp;&nbsp;How do I know what a key is mapped to?<br>
<a class="Identifier" href="vim_faq.html#faq-20.2">faq-20.2</a>&nbsp;&nbsp;How do I list all the user-defined key mappings?<br>
<a class="Identifier" href="vim_faq.html#faq-20.3">faq-20.3</a>&nbsp;&nbsp;How do I unmap a key?<br>
<a class="Identifier" href="vim_faq.html#faq-20.4">faq-20.4</a>&nbsp;&nbsp;I am not able to create a mapping for the&nbsp;<span class="Special">&lt;xxx&gt;</span>&nbsp;key. What is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wrong?<br>
<a class="Identifier" href="vim_faq.html#faq-20.5">faq-20.5</a>&nbsp;&nbsp;Why does mapping the &lt;C-...&gt; key not work?<br>
<a class="Identifier" href="vim_faq.html#faq-20.6">faq-20.6</a>&nbsp;&nbsp;How do I map the numeric keypad keys?<br>
<a class="Identifier" href="vim_faq.html#faq-20.7">faq-20.7</a>&nbsp;&nbsp;How do I create a mapping that works only in visual mode?<br>
<a class="Identifier" href="vim_faq.html#faq-20.8">faq-20.8</a>&nbsp;&nbsp;How do I create a mapping that works only in normal and operator<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pending mode (but not in visual mode)?<br>
<a class="Identifier" href="vim_faq.html#faq-20.9">faq-20.9</a>&nbsp;&nbsp;In a Vim script, how do I know which keys to use for my mappings,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;so that the mapped key will not collide with an already used key?<br>
<a class="Identifier" href="vim_faq.html#faq-20.10">faq-20.10</a>&nbsp;How do I map the escape key?<br>
<a class="Identifier" href="vim_faq.html#faq-20.11">faq-20.11</a>&nbsp;How do I map a key to perform nothing?<br>
<a class="Identifier" href="vim_faq.html#faq-20.12">faq-20.12</a>&nbsp;I want to use the Tab key to indent a block of text and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Shift-Tab key to unindent a block of text. How do I map the keys<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to do this?&nbsp;&nbsp;This behavior is similar to textpad, visual studio,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;etc.<br>
<a class="Identifier" href="vim_faq.html#faq-20.13">faq-20.13</a>&nbsp;In my mappings the special characters like&nbsp;<span class="Special">&lt;CR&gt;</span>&nbsp;are not<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;recognized. How can I configure Vim to recognize special<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters?<br>
<a class="Identifier" href="vim_faq.html#faq-20.14">faq-20.14</a>&nbsp;How do I use the '|' to separate multiple commands in a map?<br>
<a class="Identifier" href="vim_faq.html#faq-20.15">faq-20.15</a>&nbsp;If I have a mapping/abbreviation whose ending is the beginning of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;another mapping/abbreviation, how do I keep the first from<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;expanding into the second one?<br>
<a class="Identifier" href="vim_faq.html#faq-20.16">faq-20.16</a>&nbsp;Why does it take a second or more for Vim to process a key,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sometimes when I press a key?<br>
<a class="Identifier" href="vim_faq.html#faq-20.17">faq-20.17</a>&nbsp;How do I map a key to run an external command using a visually<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selected text?<br>
<a class="Identifier" href="vim_faq.html#faq-20.18">faq-20.18</a>&nbsp;How do I map the Ctrl-I key while still retaining the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;functionality of the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key?<br>
<a class="Identifier" href="vim_faq.html#faq-20.19">faq-20.19</a>&nbsp;How do I define a map to accept a count?<br>
<a class="Identifier" href="vim_faq.html#faq-20.20">faq-20.20</a>&nbsp;How can I make my normal mode mapping work from within Insert<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Mode?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-abbreviations" name="faq-abbreviations">faq-abbreviations</a><br>
SECTION 21 - ABBREVIATIONS<br>
<a class="Identifier" href="vim_faq.html#faq-21.1">faq-21.1</a>&nbsp;&nbsp;How do I auto correct misspelled words?<br>
<a class="Identifier" href="vim_faq.html#faq-21.2">faq-21.2</a>&nbsp;&nbsp;How do I create multi-line abbreviations?<br>
<a class="Identifier" href="vim_faq.html#faq-21.3">faq-21.3</a>&nbsp;&nbsp;When my abbreviations are expanded, an additional space character<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is added at the end of the expanded text. How do I avoid this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;character?<br>
<a class="Identifier" href="vim_faq.html#faq-21.4">faq-21.4</a>&nbsp;&nbsp;How do I insert the current date/time stamp into the file?<br>
<a class="Identifier" href="vim_faq.html#faq-21.5">faq-21.5</a>&nbsp;&nbsp;How do I prevent an abbreviation from expanding in insert mode?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-record-and-playback" name="faq-record-and-playback">faq-record-and-playback</a><br>
SECTION 22 - RECORD AND PLAYBACK<br>
<a class="Identifier" href="vim_faq.html#faq-22.1">faq-22.1</a>&nbsp;&nbsp;How do I repeat an editing operation (insertion, deletion, paste,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;etc)?<br>
<a class="Identifier" href="vim_faq.html#faq-22.2">faq-22.2</a>&nbsp;&nbsp;How I record and repeat a set of key sequences?<br>
<a class="Identifier" href="vim_faq.html#faq-22.3">faq-22.3</a>&nbsp;&nbsp;How do I edit/modify a recorded set of key sequences?<br>
<a class="Identifier" href="vim_faq.html#faq-22.4">faq-22.4</a>&nbsp;&nbsp;How do I write recorded key sequences to a file?<br>
<a class="Identifier" href="vim_faq.html#faq-22.5">faq-22.5</a>&nbsp;&nbsp;I am using register 0 to record my key sequences (i.e. q0 ....<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;q). In the recorded key sequences, I am yanking some text.&nbsp;&nbsp;After<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the first replay of the recorded key sequence, I am no longer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;able to play it back.<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-autocommands" name="faq-autocommands">faq-autocommands</a><br>
SECTION 23 - AUTOCOMMANDS<br>
<a class="Identifier" href="vim_faq.html#faq-23.1">faq-23.1</a>&nbsp;&nbsp;How do I execute a command when I try to modify a read-only file?<br>
<a class="Identifier" href="vim_faq.html#faq-23.2">faq-23.2</a>&nbsp;&nbsp;How do I execute a command every time when entering a buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-23.3">faq-23.3</a>&nbsp;&nbsp;How do I execute a command every time when entering a window?<br>
<a class="Identifier" href="vim_faq.html#faq-23.4">faq-23.4</a>&nbsp;&nbsp;From an autocmd, how can I determine the name of the file or the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer number for which the autocommand is executed?<br>
<a class="Identifier" href="vim_faq.html#faq-23.5">faq-23.5</a>&nbsp;&nbsp;How do I automatically save all the changed buffers whenever Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loses focus?<br>
<a class="Identifier" href="vim_faq.html#faq-23.6">faq-23.6</a>&nbsp;&nbsp;How do I execute/run a function when Vim exits to do some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cleanup?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-syntax-highlight" name="faq-syntax-highlight">faq-syntax-highlight</a><br>
SECTION 24 - SYNTAX HIGHLIGHT<br>
<a class="Identifier" href="vim_faq.html#faq-24.1">faq-24.1</a>&nbsp;&nbsp;How do I turn off/on syntax highlighting?<br>
<a class="Identifier" href="vim_faq.html#faq-24.2">faq-24.2</a>&nbsp;&nbsp;How do I change the background and foreground colors used by Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-24.3">faq-24.3</a>&nbsp;&nbsp;How do I change the highlight colors to suit a dark/light<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;background?<br>
<a class="Identifier" href="vim_faq.html#faq-24.4">faq-24.4</a>&nbsp;&nbsp;How do I change the color of the line numbers displayed when the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;:set number&quot; command is used?<br>
<a class="Identifier" href="vim_faq.html#faq-24.5">faq-24.5</a>&nbsp;&nbsp;How do I change the background color used for a Visually selected<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;block?<br>
<a class="Identifier" href="vim_faq.html#faq-24.6">faq-24.6</a>&nbsp;&nbsp;How do I highlight the special characters (tabs, trailing spaces,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end of line, etc) displayed by the&nbsp;<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-24.7">faq-24.7</a>&nbsp;&nbsp;How do I specify a colorscheme in my .vimrc/.gvimrc file, so that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim uses the specified colorscheme every time?<br>
<a class="Identifier" href="vim_faq.html#faq-24.8">faq-24.8</a>&nbsp;&nbsp;Vim syntax highlighting is broken. When I am editing a file, some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parts of the file is not syntax highlighted or syntax highlighted<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incorrectly.<br>
<a class="Identifier" href="vim_faq.html#faq-24.9">faq-24.9</a>&nbsp;&nbsp;Is there a built-in function to syntax-highlight the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;corresponding matching bracket?<br>
<a class="Identifier" href="vim_faq.html#faq-24.10">faq-24.10</a>&nbsp;How do I turn off the C comment syntax highlighting?<br>
<a class="Identifier" href="vim_faq.html#faq-24.11">faq-24.11</a>&nbsp;How do I add my own syntax extensions to the standard syntax<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files supplied with Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-24.12">faq-24.12</a>&nbsp;How do I replace a standard syntax file that comes with the Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;distribution with my own syntax file?<br>
<a class="Identifier" href="vim_faq.html#faq-24.13">faq-24.13</a>&nbsp;How do I highlight all the characters after a particular column?<br>
<a class="Identifier" href="vim_faq.html#faq-24.14">faq-24.14</a>&nbsp;How do I convert a source file (.c, .h, etc) with the Vim syntax<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;highlighting into a HTML file?<br>
<a class="Identifier" href="vim_faq.html#faq-24.15">faq-24.15</a>&nbsp;How do I list the definition of all the current highlight<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;groups?<br>
<a class="Identifier" href="vim_faq.html#faq-24.16">faq-24.16</a>&nbsp;How can I embed one syntax highlighting language into another<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;one?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-vim-script-writing" name="faq-vim-script-writing">faq-vim-script-writing</a><br>
SECTION 25 - VIM SCRIPT WRITING<br>
<a class="Identifier" href="vim_faq.html#faq-25.1">faq-25.1</a>&nbsp;&nbsp;How do I list the names of all the scripts sourced by Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-25.2">faq-25.2</a>&nbsp;&nbsp;How do I debug Vim scripts?<br>
<a class="Identifier" href="vim_faq.html#faq-25.3">faq-25.3</a>&nbsp;&nbsp;How do I locate the script/plugin which sets a Vim option?<br>
<a class="Identifier" href="vim_faq.html#faq-25.4">faq-25.4</a>&nbsp;&nbsp;I am getting some error/informational messages from Vim (possibly<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when running a script), the messages are cleared immediately. How<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do I display the messages again?<br>
<a class="Identifier" href="vim_faq.html#faq-25.5">faq-25.5</a>&nbsp;&nbsp;How do I save and restore a plugin specific information across<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim invocations?<br>
<a class="Identifier" href="vim_faq.html#faq-25.6">faq-25.6</a>&nbsp;&nbsp;How do I start insert mode from a Vim function?<br>
<a class="Identifier" href="vim_faq.html#faq-25.7">faq-25.7</a>&nbsp;&nbsp;How do I change the cursor position from within a Vim function?<br>
<a class="Identifier" href="vim_faq.html#faq-25.8">faq-25.8</a>&nbsp;&nbsp;How do I check the value of an environment variable in the .vimrc<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file?<br>
<a class="Identifier" href="vim_faq.html#faq-25.9">faq-25.9</a>&nbsp;&nbsp;How do I check whether an environment variable is set or not from<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a Vim function?<br>
<a class="Identifier" href="vim_faq.html#faq-25.10">faq-25.10</a>&nbsp;How do I call/use the Vim built-in functions?<br>
<a class="Identifier" href="vim_faq.html#faq-25.11">faq-25.11</a>&nbsp;I am using some normal mode commands in my Vim script. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;avoid using the user-defined mappings for these normal mode<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;commands and use the standard Vim functionality for these normal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mode commands?<br>
<a class="Identifier" href="vim_faq.html#faq-25.12">faq-25.12</a>&nbsp;How do I get a visually selected text into a Vim variable or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;register?<br>
<a class="Identifier" href="vim_faq.html#faq-25.13">faq-25.13</a>&nbsp;I have some text in a Vim variable&nbsp;<span class="MissingTag">'myvar'</span>. I would like to use<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this variable in a &quot;:s&quot; substitute command to replace a text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="MissingTag">'mytext'</span>. How do I do this?<br>
<a class="Identifier" href="vim_faq.html#faq-25.14">faq-25.14</a>&nbsp;A Vim variable (bno) contains a buffer number. How do I use this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;variable to open the corresponding buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-25.15">faq-25.15</a>&nbsp;How do I store the value of a Vim option into a Vim variable?<br>
<a class="Identifier" href="vim_faq.html#faq-25.16">faq-25.16</a>&nbsp;I have copied and inserted some text into a buffer from a Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function. How do I indent the inserted text from the Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function?<br>
<a class="Identifier" href="vim_faq.html#faq-25.17">faq-25.17</a>&nbsp;How do I get the character under the cursor from a Vim script?<br>
<a class="Identifier" href="vim_faq.html#faq-25.18">faq-25.18</a>&nbsp;How do I get the name of the current file without the extension?<br>
<a class="Identifier" href="vim_faq.html#faq-25.19">faq-25.19</a>&nbsp;How do I get the basename of the current file?<br>
<a class="Identifier" href="vim_faq.html#faq-25.20">faq-25.20</a>&nbsp;How do I get the output from a Vim function into the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-25.21">faq-25.21</a>&nbsp;How do I call external programs from a Vim function?<br>
<a class="Identifier" href="vim_faq.html#faq-25.22">faq-25.22</a>&nbsp;How do I get the return status of a program executed using the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;:!&quot; command?<br>
<a class="Identifier" href="vim_faq.html#faq-25.23">faq-25.23</a>&nbsp;How do I determine whether the current buffer is modified or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not?<br>
<a class="Identifier" href="vim_faq.html#faq-25.24">faq-25.24</a>&nbsp;I would like to use the carriage return character in a normal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command from a Vim script. How do I specify the carriage return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;character?<br>
<a class="Identifier" href="vim_faq.html#faq-25.25">faq-25.25</a>&nbsp;How do I split long lines in a Vim script?<br>
<a class="Identifier" href="vim_faq.html#faq-25.26">faq-25.26</a>&nbsp;When I try to &quot;execute&quot; my function using the &quot;execute 'echo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Myfunc()'&quot; command, the cursor is moved to the top of the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;current buffer.&nbsp;&nbsp;Why?<br>
<a class="Identifier" href="vim_faq.html#faq-25.27">faq-25.27</a>&nbsp;How do I source/execute the contents of a register?<br>
<a class="Identifier" href="vim_faq.html#faq-25.28">faq-25.28</a>&nbsp;After calling a Vim function or a mapping, when I press the 'u'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;key to undo the last change, Vim undoes all the changes made by<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the mapping/function. Why?<br>
<a class="Identifier" href="vim_faq.html#faq-25.29">faq-25.29</a>&nbsp;How can I call a function defined with s: (script local<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;function) from another script/plugin?<br>
<a class="Identifier" href="vim_faq.html#faq-25.30">faq-25.30</a>&nbsp;Is it possible to un-source a sourced script? In other words,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reverse all the commands executed by sourcing a script.<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-plugins" name="faq-plugins">faq-plugins</a><br>
SECTION 26 - PLUGINS<br>
<a class="Identifier" href="vim_faq.html#faq-26.1">faq-26.1</a>&nbsp;&nbsp;How do I set different options for different types of files?<br>
<a class="Identifier" href="vim_faq.html#faq-26.2">faq-26.2</a>&nbsp;&nbsp;I have downloaded a Vim plugin or a syntax file or a indent file,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or a color scheme or a filetype plugin from the web. Where should<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I copy these files so that Vim will find them?<br>
<a class="Identifier" href="vim_faq.html#faq-26.3">faq-26.3</a>&nbsp;&nbsp;How do I extend an existing filetype plugin?<br>
<a class="Identifier" href="vim_faq.html#faq-26.4">faq-26.4</a>&nbsp;&nbsp;How do I turn off loading the Vim plugins?<br>
<a class="Identifier" href="vim_faq.html#faq-26.5">faq-26.5</a>&nbsp;&nbsp;How do I turn on/off loading the filetype plugins?<br>
<a class="Identifier" href="vim_faq.html#faq-26.6">faq-26.6</a>&nbsp;&nbsp;How do I override settings made in a file type plugin in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;global ftplugin directory for all the file types?<br>
<a class="Identifier" href="vim_faq.html#faq-26.7">faq-26.7</a>&nbsp;&nbsp;How do I disable the Vim directory browser plugin?<br>
<a class="Identifier" href="vim_faq.html#faq-26.8">faq-26.8</a>&nbsp;&nbsp;How do I set the filetype option for files with names matching a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particular pattern or depending on the file extension?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-editing-program-files" name="faq-editing-program-files">faq-editing-program-files</a><br>
SECTION 27 - EDITING PROGRAM FILES<br>
<a class="Identifier" href="vim_faq.html#faq-27.1">faq-27.1</a>&nbsp;&nbsp;How do I enable automatic indentation for C/C++ files?<br>
<a class="Identifier" href="vim_faq.html#faq-27.2">faq-27.2</a>&nbsp;&nbsp;How do I configure the indentation used for C/C++ files?<br>
<a class="Identifier" href="vim_faq.html#faq-27.3">faq-27.3</a>&nbsp;&nbsp;How do I turn off the automatic indentation feature?<br>
<a class="Identifier" href="vim_faq.html#faq-27.4">faq-27.4</a>&nbsp;&nbsp;How do I change the number of space characters used for the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;automatic indentation?<br>
<a class="Identifier" href="vim_faq.html#faq-27.5">faq-27.5</a>&nbsp;&nbsp;I am editing a C program using Vim. How do I display the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;definition of a macro or a variable?<br>
<a class="Identifier" href="vim_faq.html#faq-27.6">faq-27.6</a>&nbsp;&nbsp;I am editing a C program using Vim. How do I jump to the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beginning or end of a code block from within the block?<br>
<a class="Identifier" href="vim_faq.html#faq-27.7">faq-27.7</a>&nbsp;&nbsp;When editing C++ files and when inserting new lines above or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;below a comment (//) line, Vim automatically inserts the C++<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comment character (//) at the beginning of the line. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disable this?&nbsp;<br>
<a class="Identifier" href="vim_faq.html#faq-27.8">faq-27.8</a>&nbsp;&nbsp;How do I add the comment character '#' to a set of lines at the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beginning of each line?<br>
<a class="Identifier" href="vim_faq.html#faq-27.9">faq-27.9</a>&nbsp;&nbsp;How do I edit a header file with the same name as the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;corresponding C source file?<br>
<a class="Identifier" href="vim_faq.html#faq-27.10">faq-27.10</a>&nbsp;How do I automatically insert comment leaders while typing<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comments?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-quickfix" name="faq-quickfix">faq-quickfix</a><br>
SECTION 28 - QUICKFIX<br>
<a class="Identifier" href="vim_faq.html#faq-28.1">faq-28.1</a>&nbsp;&nbsp;How do I build programs from Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-28.2">faq-28.2</a>&nbsp;&nbsp;When I run the make command in Vim I get the errors listed as the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compiler compiles the program. When it finishes this list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disappears and I have to use the&nbsp;&nbsp;:clist command to see the error<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;message again. Is there any other way to see these error<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;messages?<br>
<a class="Identifier" href="vim_faq.html#faq-28.3">faq-28.3</a>&nbsp;&nbsp;How can I perform a command for each item in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;quickfix/location list?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-folding" name="faq-folding">faq-folding</a><br>
SECTION 29 - FOLDING<br>
<a class="Identifier" href="vim_faq.html#faq-29.1">faq-29.1</a>&nbsp;&nbsp;How do I extend the Vim folding support?<br>
<a class="Identifier" href="vim_faq.html#faq-29.2">faq-29.2</a>&nbsp;&nbsp;When I enable folding by setting the&nbsp;<a class="Type" href="options.html#'foldmethod'">'foldmethod'</a>&nbsp;option, all the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folds are closed. How do I prevent this?<br>
<a class="Identifier" href="vim_faq.html#faq-29.3">faq-29.3</a>&nbsp;&nbsp;How do I control how many folds will be opened when I start<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;editing a file?<br>
<a class="Identifier" href="vim_faq.html#faq-29.4">faq-29.4</a>&nbsp;&nbsp;How do I open and close folds using the mouse?<br>
<a class="Identifier" href="vim_faq.html#faq-29.5">faq-29.5</a>&nbsp;&nbsp;How do I change the text displayed for a closed fold?<br>
<a class="Identifier" href="vim_faq.html#faq-29.6">faq-29.6</a>&nbsp;&nbsp;How do I store and restore manually created folds across<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;different Vim invocations?<br>
<a class="Identifier" href="vim_faq.html#faq-29.7">faq-29.7</a>&nbsp;&nbsp;I have enabled syntax based folding. Why is Vim so slow?<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-vim-with-external-applications" name="faq-vim-with-external-applications">faq-vim-with-external-applications</a><br>
SECTION 30 - VIM WITH EXTERNAL APPLICATIONS<br>
<a class="Identifier" href="vim_faq.html#faq-30.1">faq-30.1</a>&nbsp;&nbsp;Can I run a shell inside a Vim window?<br>
<a class="Identifier" href="vim_faq.html#faq-30.2">faq-30.2</a>&nbsp;&nbsp;How do I pass the word under the cursor to an external command?<br>
<a class="Identifier" href="vim_faq.html#faq-30.3">faq-30.3</a>&nbsp;&nbsp;How do I get the output of a shell command into a Vim buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-30.4">faq-30.4</a>&nbsp;&nbsp;How do I pipe the contents of the current buffer to an external<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command and replace the contents of the buffer with the output<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from the command?<br>
<a class="Identifier" href="vim_faq.html#faq-30.5">faq-30.5</a>&nbsp;&nbsp;How do I sort a section of my file?<br>
<a class="Identifier" href="vim_faq.html#faq-30.6">faq-30.6</a>&nbsp;&nbsp;How do I use Vim as a pager?<br>
<a class="Identifier" href="vim_faq.html#faq-30.7">faq-30.7</a>&nbsp;&nbsp;How do I view Unix man pages from inside Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-30.8">faq-30.8</a>&nbsp;&nbsp;How do I change the diff command used by the Vim diff support?<br>
<a class="Identifier" href="vim_faq.html#faq-30.9">faq-30.9</a>&nbsp;&nbsp;How do I use the Vim diff mode without folding?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-gui-vim" name="faq-gui-vim">faq-gui-vim</a><br>
SECTION 31 - GUI VIM<br>
<a class="Identifier" href="vim_faq.html#faq-31.1">faq-31.1</a>&nbsp;&nbsp;How do I create buffer specific menus?<br>
<a class="Identifier" href="vim_faq.html#faq-31.2">faq-31.2</a>&nbsp;&nbsp;How do I change the font used by GUI Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-31.3">faq-31.3</a>&nbsp;&nbsp;When starting GUI Vim, how do I specify the location of the GVIM<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window?<br>
<a class="Identifier" href="vim_faq.html#faq-31.4">faq-31.4</a>&nbsp;&nbsp;How do I add a horizontal scrollbar in GVim?<br>
<a class="Identifier" href="vim_faq.html#faq-31.5">faq-31.5</a>&nbsp;&nbsp;How do I make the scrollbar appear in the left side by default?<br>
<a class="Identifier" href="vim_faq.html#faq-31.6">faq-31.6</a>&nbsp;&nbsp;How do I remove the Vim menubar?<br>
<a class="Identifier" href="vim_faq.html#faq-31.7">faq-31.7</a>&nbsp;&nbsp;I am using GUI Vim. When I press the ALT key and a letter, the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;menu starting with that letter is selected. I don't want this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;behavior as I want to map the ALT-<span class="Special">&lt;key&gt;</span>&nbsp;combination. How do I do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this?<br>
<a class="Identifier" href="vim_faq.html#faq-31.8">faq-31.8</a>&nbsp;&nbsp;Is it possible to scroll the text by dragging the scrollbar so<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that the cursor stays in the original location?<br>
<a class="Identifier" href="vim_faq.html#faq-31.9">faq-31.9</a>&nbsp;&nbsp;How do I get gvim to start browsing files in a particular<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory when using the &quot;:browse&quot; command?<br>
<a class="Identifier" href="vim_faq.html#faq-31.10">faq-31.10</a>&nbsp;For some questions, like when a file is changed outside of Vim,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim displays a GUI dialog box. How do I replace this GUI dialog<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;box with a console dialog box?<br>
<a class="Identifier" href="vim_faq.html#faq-31.11">faq-31.11</a>&nbsp;I am trying to use GUI Vim as the editor for my xxx application.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When the xxx application launches GUI Vim to edit a file, the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;control immediately returns to the xxx application. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;start GUI Vim, so that the control returns to the xxx<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;application only after I quit Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-31.12">faq-31.12</a>&nbsp;Why does the &quot;Select Font&quot; dialog doesn't show all the fonts<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;installed in my system?<br>
<a class="Identifier" href="vim_faq.html#faq-31.13">faq-31.13</a>&nbsp;How do I use the mouse in Vim command-line mode?<br>
<a class="Identifier" href="vim_faq.html#faq-31.14">faq-31.14</a>&nbsp;When I use the middle mouse button to scroll text, it pastes the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;last copied text. How do I disable this behavior?<br>
<a class="Identifier" href="vim_faq.html#faq-31.15">faq-31.15</a>&nbsp;How do I change the location and size of a GUI Vim window?<br>
<a class="Identifier" href="vim_faq.html#faq-31.16">faq-31.16</a>&nbsp;When splitting the Vim window vertically, Vim changes<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the position.<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-vim-on-unix" name="faq-vim-on-unix">faq-vim-on-unix</a><br>
SECTION 32 - VIM ON UNIX<br>
<a class="Identifier" href="vim_faq.html#faq-32.1">faq-32.1</a>&nbsp;&nbsp;I am running Vim in a xterm. When I press the&nbsp;<span class="Special">CTRL-S</span>&nbsp;key, Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;freezes. What should I do now?<br>
<a class="Identifier" href="vim_faq.html#faq-32.2">faq-32.2</a>&nbsp;&nbsp;I am seeing weird screen update problems in Vim. What can I do to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;solve this screen/display update problems?<br>
<a class="Identifier" href="vim_faq.html#faq-32.3">faq-32.3</a>&nbsp;&nbsp;I am using the terminal/console version of Vim. In insertmode,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When I press the backspace key, the character before the cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;is not erased. How do I configure Vim to do this?<br>
<a class="Identifier" href="vim_faq.html#faq-32.4">faq-32.4</a>&nbsp;&nbsp;I am using Vim in a xterm. When I quit Vim, the screen contents<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are restored back to the original contents. How do I disable<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;this?<br>
<a class="Identifier" href="vim_faq.html#faq-32.5">faq-32.5</a>&nbsp;&nbsp;When I start Vim, it takes quite a few seconds to start. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;minimize the startup time?<br>
<a class="Identifier" href="vim_faq.html#faq-32.6">faq-32.6</a>&nbsp;&nbsp;How can I make the cursor in gvim in unix stop blinking?<br>
<a class="Identifier" href="vim_faq.html#faq-32.7">faq-32.7</a>&nbsp;&nbsp;How do I change the menu font on GTK Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-32.8">faq-32.8</a>&nbsp;&nbsp;How do I prevent&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;from suspending Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-32.9">faq-32.9</a>&nbsp;&nbsp;When I kill the xterm running Vim, the Vim process continues to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;run and takes up a lot of CPU (99%) time. Why is this happening?<br>
<a class="Identifier" href="vim_faq.html#faq-32.10">faq-32.10</a>&nbsp;How do I get the Vim syntax highlighting to work in a Unix<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;terminal?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-vim-on-ms-windows" name="faq-vim-on-ms-windows">faq-vim-on-ms-windows</a><br>
SECTION 33 - VIM ON MS-WINDOWS<br>
<a class="Identifier" href="vim_faq.html#faq-33.1">faq-33.1</a>&nbsp;&nbsp;In MS-Windows,&nbsp;<span class="Special">CTRL-V</span>&nbsp;doesn't start the blockwise visual mode.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What happened?<br>
<a class="Identifier" href="vim_faq.html#faq-33.2">faq-33.2</a>&nbsp;&nbsp;When I press the&nbsp;<span class="Special">CTRL-Y</span>&nbsp;key, it acts like the&nbsp;<span class="Special">CTRL-R</span>&nbsp;key. How do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I configure Vim to treat&nbsp;<span class="Special">CTRL-Y</span>&nbsp;as&nbsp;<span class="Special">CTRL-Y</span>?<br>
<a class="Identifier" href="vim_faq.html#faq-33.3">faq-33.3</a>&nbsp;&nbsp;How do I start GUI Vim in a maximized window always?<br>
<a class="Identifier" href="vim_faq.html#faq-33.4">faq-33.4</a>&nbsp;&nbsp;After doing some editing operations, Vim freezes. The cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;becomes an empty rectangle. I am not able enter any characters.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;What is happening?<br>
<a class="Identifier" href="vim_faq.html#faq-33.5">faq-33.5</a>&nbsp;&nbsp;I am using Windows XP, the display speed of maximized GVim is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;very slow. What can I do to speed the display updates?<br>
<a class="Identifier" href="vim_faq.html#faq-33.6">faq-33.6</a>&nbsp;&nbsp;What are the recommended settings for using Vim with cygwin?<br>
<a class="Identifier" href="vim_faq.html#faq-33.7">faq-33.7</a>&nbsp;&nbsp;I am trying to use GNU diff with Vim diff mode. When I run the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;diff from command line, it works. When I try to use the diff with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim it doesn't work. What should I do now?<br>
<a class="Identifier" href="vim_faq.html#faq-33.8">faq-33.8</a>&nbsp;&nbsp;Is it possible to use Vim as an external editor for MS-Windows<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Outlook email client?<br>
<a class="Identifier" href="vim_faq.html#faq-33.9">faq-33.9</a>&nbsp;&nbsp;I am using Vim to edit HTML files. How do I start internet<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;explorer with the current file to preview the HTML file?<br>
<a class="Identifier" href="vim_faq.html#faq-33.10">faq-33.10</a>&nbsp;I would like to use Vim with Microsoft Visual Studio. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;do this?<br>
<a class="Identifier" href="vim_faq.html#faq-33.11">faq-33.11</a>&nbsp;Where do I place the _vimrc and _gvimrc files?<br>
<a class="Identifier" href="vim_faq.html#faq-33.12">faq-33.12</a>&nbsp;Every time I save a file, Vim warns about the file being changed<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;outside of Vim. Why?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-printing" name="faq-printing">faq-printing</a><br>
SECTION 34 - PRINTING<br>
<a class="Identifier" href="vim_faq.html#faq-34.1">faq-34.1</a>&nbsp;&nbsp;How do I print a file along with line numbers for all the lines?<br>
<a class="Identifier" href="vim_faq.html#faq-34.2">faq-34.2</a>&nbsp;&nbsp;How do I print a file with the Vim syntax highlighting colors?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-building-vim-from-source" name="faq-building-vim-from-source">faq-building-vim-from-source</a><br>
SECTION 35 - BUILDING VIM FROM SOURCE<br>
<a class="Identifier" href="vim_faq.html#faq-35.1">faq-35.1</a>&nbsp;&nbsp;How do I build Vim from the sources on a Unix system?<br>
<a class="Identifier" href="vim_faq.html#faq-35.2">faq-35.2</a>&nbsp;&nbsp;How do I install Vim in my home directory or a directory other<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;than the default installation directory in Unix?<br>
<a class="Identifier" href="vim_faq.html#faq-35.3">faq-35.3</a>&nbsp;&nbsp;How do I build Vim from the sources on a MS-Windows system?<br>
<a class="Identifier" href="vim_faq.html#faq-35.4">faq-35.4</a>&nbsp;&nbsp;The Vim help, syntax, indent files are missing from my Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;installation. How do I install these files?<br>
<a class="Identifier" href="vim_faq.html#faq-35.5">faq-35.5</a>&nbsp;&nbsp;I have built Vim from the source and installed the Vim package<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;using &quot;make install&quot;. Do I need to keep the Vim source directory?<br>
<a class="Identifier" href="vim_faq.html#faq-35.6">faq-35.6</a>&nbsp;&nbsp;How do I determine the Vim features which are enabled at compile<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time?<br>
<a class="Identifier" href="vim_faq.html#faq-35.7">faq-35.7</a>&nbsp;&nbsp;Can I build Vim without the GUI support?<br>
<a class="Identifier" href="vim_faq.html#faq-35.8">faq-35.8</a>&nbsp;&nbsp;When building Vim on a Unix system, I am getting &quot;undefined<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reference to term_set_winsize&quot; error. How do I resolve this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error?<br>
<a class="Identifier" href="vim_faq.html#faq-35.9">faq-35.9</a>&nbsp;&nbsp;Vim configure keeps complaining about the lack of gtk-config<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;while trying to use GTK 2.03. This is correct, since in GTK 2<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;they moved to using the generic pkg-config. I can get pkg-config<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to list the various includes and libs for gtk, but for some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;reason the configure script still isn't picking this up.<br>
<a class="Identifier" href="vim_faq.html#faq-35.10">faq-35.10</a>&nbsp;I did successfully download the sources and compiled Vim on<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unix. But feature ... still does not work. What is wrong and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;how can I fix it?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-various" name="faq-various">faq-various</a><br>
SECTION 36 - VARIOUS<br>
<a class="Identifier" href="vim_faq.html#faq-36.1">faq-36.1</a>&nbsp;&nbsp;How do I edit binary files with Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-36.2">faq-36.2</a>&nbsp;&nbsp;How do I disable the visual error flash and the error beep?<br>
<a class="Identifier" href="vim_faq.html#faq-36.3">faq-36.3</a>&nbsp;&nbsp;How do I display the ascii value of a character displayed in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<a class="Identifier" href="vim_faq.html#faq-36.4">faq-36.4</a>&nbsp;&nbsp;Can I use zero as a count for a Vim command?<br>
<a class="Identifier" href="vim_faq.html#faq-36.5">faq-36.5</a>&nbsp;&nbsp;How do I disable the Vim welcome screen?<br>
<a class="Identifier" href="vim_faq.html#faq-36.6">faq-36.6</a>&nbsp;&nbsp;How do I avoid the &quot;hit enter to continue&quot; prompt?<br>
<a class="Identifier" href="vim_faq.html#faq-36.7">faq-36.7</a>&nbsp;&nbsp;How do I invoke Vim from command line to run a group of commands<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;on a group of files?<br>
<a class="Identifier" href="vim_faq.html#faq-36.8">faq-36.8</a>&nbsp;&nbsp;How do I use a normal mode command from insert mode without<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;leaving the insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-36.9">faq-36.9</a>&nbsp;&nbsp;How do I start Vim in insert mode?<br>
<a class="Identifier" href="vim_faq.html#faq-36.10">faq-36.10</a>&nbsp;How do I use Copy and Paste with Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-36.11">faq-36.11</a>&nbsp;Why shouldn't I modify the files in the system runtime<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directory?<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-unicode" name="faq-unicode">faq-unicode</a><br>
SECTION 37 - UNICODE<br>
<a class="Identifier" href="vim_faq.html#faq-37.1">faq-37.1</a>&nbsp;&nbsp;Is it possible to create Unicode files using Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-37.2">faq-37.2</a>&nbsp;&nbsp;Which Vim settings are particularly important for editing Unicode<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files?<br>
<a class="Identifier" href="vim_faq.html#faq-37.3">faq-37.3</a>&nbsp;&nbsp;What is the&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-37.4">faq-37.4</a>&nbsp;&nbsp;How does Vim name the various Unicode encodings?<br>
<a class="Identifier" href="vim_faq.html#faq-37.5">faq-37.5</a>&nbsp;&nbsp;How does Vim specify the presence or absence of a byte-order<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;mark?<br>
<a class="Identifier" href="vim_faq.html#faq-37.6">faq-37.6</a>&nbsp;&nbsp;What is the&nbsp;<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-37.7">faq-37.7</a>&nbsp;&nbsp;What is the&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-37.8">faq-37.8</a>&nbsp;&nbsp;What is the&nbsp;<a class="Type" href="options.html#'termencoding'">'termencoding'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-37.9">faq-37.9</a>&nbsp;&nbsp;What is the&nbsp;<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;option?<br>
<a class="Identifier" href="vim_faq.html#faq-37.10">faq-37.10</a>&nbsp;Where can I find an example of a typical use of all these<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;options?<br>
<a class="Identifier" href="vim_faq.html#faq-37.11">faq-37.11</a>&nbsp;How can I insert Unicode characters into a file using Vim?<br>
<a class="Identifier" href="vim_faq.html#faq-37.12">faq-37.12</a>&nbsp;How can I know which digraphs are defined and for which<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters?<br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1" name="faq-1">faq-1</a><br>
SECTION 1 - GENERAL INFORMATION<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1.1" name="faq-1.1">faq-1.1</a><br>
1.1. What is Vim?<br>
<br>
Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so<br>
many improvements that a name change was appropriate. Vim is a text editor<br>
which includes almost all the commands from the Unix program &quot;Vi&quot; and a lot<br>
of new ones. All commands can be given with the keyboard. This has the<br>
advantage that you can keep your fingers on the keyboard and your eyes on<br>
the screen. For those who want it, there is mouse support and a GUI version<br>
with scrollbars and menus.<br>
<br>
Vim is an editor, not a word processor. A word processor is used mainly<br>
to do layout of text. This means positioning it, changing the way it<br>
appears on output. More often than not, the final document is meant to<br>
be printed or typeset or what have you, in order to present it in a<br>
pleasing manner to others. Examples of word processors are Microsoft<br>
Word, FrameMaker, and OpenOffice Writer.<br>
<br>
An editor is simply for entering text. Any typesetting or laying out of the<br>
document is secondary. With an editor, one's main concern is entering text,<br>
not making the text look good. Examples of editors other than Vim and Vi<br>
are Emacs, TextMate, Ultraedit and gedit. And Notepad.<br>
<br>
For more information read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#intro">intro</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1.2" name="faq-1.2">faq-1.2</a><br>
1.2. Who wrote Vim?<br>
<br>
Most of Vim is based on Stevie and was written by Bram Moolenaar, with contributions from too many<br>
people to mention here.<br>
<br>
For more information, read:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#author">author</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#credits">credits</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1.3" name="faq-1.3">faq-1.3</a><br>
1.3. Is Vim compatible with Vi?<br>
<br>
Yes. Vim is very much compatible with Vi.&nbsp;&nbsp;You can use the &quot;-C&quot;<br>
command-line flag to start Vim in Vi compatible mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -C</div>
<br>
You can also use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -u NONE</div>
<br>
You can also set the&nbsp;<a class="Type" href="options.html#'compatible'">'compatible'</a>&nbsp;option to enable Vi compatibility:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set compatible</div>
<br>
If you want to make sure, to start Vim in a&nbsp;<a class="Type" href="options.html#'nocompatible'">'nocompatible'</a>&nbsp;mode to<br>
original Vi, supply the -<span class="Special">N</span>&nbsp;command line argument:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -N</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-C">-C</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-N">-N</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'compatible'">'compatible'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#compatible-default">compatible-default</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1.4" name="faq-1.4">faq-1.4</a><br>
1.4. What are some of the improvements of Vim over Vi?<br>
<br>
A short summary of the improvements of Vim over vi is listed below.&nbsp;&nbsp;The<br>
list shows that Vim is a thoroughly modern and feature-packed editor.<br>
Standard features of modern editors are implemented, and there is an equal<br>
emphasis on general power-user features and features for programmers.<br>
<br>
Features to modernise Vi&#0058;<br>
<br>
&nbsp;&nbsp;Multi-level undo<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Allows you to set the number of times you can undo your changes in a<br>
&nbsp;&nbsp;&nbsp;&nbsp; file buffer. You can also redo an undone change.<br>
&nbsp;&nbsp;&nbsp;&nbsp; Also starting with version 7.3 Vim can permanently store your undo<br>
&nbsp;&nbsp;&nbsp;&nbsp; information, so that you can undo your changes which you have done<br>
&nbsp;&nbsp;&nbsp;&nbsp; in a previous editing session.</div>
<br>
&nbsp;&nbsp;Tabs, Multiple windows and buffers<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Each file can be displayed in its own window. You can move easily from<br>
&nbsp;&nbsp;&nbsp;&nbsp; one window to another. Each file opened during a Vim session also has<br>
&nbsp;&nbsp;&nbsp;&nbsp; an associated buffer and you can easily jump from one to the other.<br>
&nbsp;&nbsp;&nbsp;&nbsp; Also like any modern GUI, Vim supports opening several files in tabs.<br>
&nbsp;&nbsp;&nbsp;&nbsp; You can do batch processing for tabs, buffers, windows and the<br>
&nbsp;&nbsp;&nbsp;&nbsp; argumentlist.</div>
<br>
&nbsp;&nbsp;Flexible insert mode<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim allows you to use the arrow keys while in insert mode to move<br>
&nbsp;&nbsp;&nbsp;&nbsp; around in the file. No more hitting &lt;Esc&gt;, moving around, then hitting<br>
&nbsp;&nbsp;&nbsp;&nbsp; `i' or `a'.</div>
<br>
&nbsp;&nbsp;Macros<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim has a facility which allows you to record a sequence of typed<br>
&nbsp;&nbsp;&nbsp;&nbsp; characters and repeat them any number of times.</div>
<br>
&nbsp;&nbsp;Visual mode<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; You can highlight sections of text and execute operations on this<br>
&nbsp;&nbsp;&nbsp;&nbsp; section of text only.</div>
<br>
&nbsp;&nbsp;Block operators<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Allow selection and highlighting of rectangular blocks of text in<br>
&nbsp;&nbsp;&nbsp;&nbsp; order do execute specific operations on them.</div>
<br>
&nbsp;&nbsp;Online help system<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; You can easily find help on any aspect of using Vim. Help is displayed<br>
&nbsp;&nbsp;&nbsp;&nbsp; in its own window.</div>
<br>
&nbsp;&nbsp;Command-line editing and history<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; History allows you to use the arrow keys to repeat or search for a<br>
&nbsp;&nbsp;&nbsp;&nbsp; command that has already been typed. Allows you to match the beginning<br>
&nbsp;&nbsp;&nbsp;&nbsp; of a command with the beginning of another similar command in the<br>
&nbsp;&nbsp;&nbsp;&nbsp; history buffer. You can also edit a command to correct typos or change<br>
&nbsp;&nbsp;&nbsp;&nbsp; a few values.</div>
<br>
&nbsp;&nbsp;Command line completion.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Using the &lt;Tab&gt; key, you can complete commands, options, filenames,<br>
&nbsp;&nbsp;&nbsp;&nbsp; etc. as needed.</div>
<br>
&nbsp;&nbsp;Horizontal scrolling.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Long lines can be scrolled horizontally (with or without the GUI).</div>
<br>
&nbsp;&nbsp;Unicode and internationalization improvements.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim is able to edit files in unicode encoding and uses internally an<br>
&nbsp;&nbsp;&nbsp;&nbsp; utf-8 encoding. Additionally Vim can display text right to left<br>
&nbsp;&nbsp;&nbsp;&nbsp; oriented.</div>
<br>
Advanced user features:<br>
<br>
&nbsp;&nbsp;Text formatting<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; With two keystrokes, you can format large sections of text, without<br>
&nbsp;&nbsp;&nbsp;&nbsp; the use of external programs.</div>
<br>
&nbsp;&nbsp;Completion in Insert mode<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim provides several different possibilities to complete your text.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp; For example Vim can complete words while you are typing, by matching<br>
&nbsp;&nbsp;&nbsp;&nbsp; the current word with other similar words in the file.</div>
<br>
&nbsp;&nbsp;Jump tags<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Just like in an internet browser, you can jump back to previous parts<br>
&nbsp;&nbsp;&nbsp;&nbsp; of the text you were editing, and then forward again.&nbsp;&nbsp;Your brain is<br>
&nbsp;&nbsp;&nbsp;&nbsp; thus free to edit instead of navigate.</div>
<br>
&nbsp;&nbsp;Automatic commands<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Commands automatically executed when reading or writing a file,<br>
&nbsp;&nbsp;&nbsp;&nbsp; jumping to another buffer, etc.</div>
<br>
&nbsp;&nbsp;Viminfo<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Allows storing of the command line history, marks and registers in a<br>
&nbsp;&nbsp;&nbsp;&nbsp; file to be read on startup.&nbsp;&nbsp;Therefore, you can recall old search<br>
&nbsp;&nbsp;&nbsp;&nbsp; patterns, macros, etc., in a new Vim session.</div>
<br>
&nbsp;&nbsp;Mouse support<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; The mouse is supported in an xterm and for MS-DOS. It can be used to<br>
&nbsp;&nbsp;&nbsp;&nbsp; position the cursor, select the visual area, paste a register, etc.</div>
<br>
&nbsp;&nbsp;Graphical User Interface (GUI)<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; There are several different graphical user interfaces available.&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp; Also, it's very easy to add your own menus.&nbsp;&nbsp;Of course, console vim is<br>
&nbsp;&nbsp;&nbsp;&nbsp; still supported, and very widely used.</div>
<br>
&nbsp;&nbsp;Scripting language<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim has a powerful scripting language so new commands can be created.<br>
&nbsp;&nbsp;&nbsp;&nbsp; You can also use Perl, Python, TCL, Lua and Ruby to achieve the same thing!</div>
<br>
&nbsp;&nbsp;Plugins<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Extra functionality implemented via vim commands (regular commands or<br>
&nbsp;&nbsp;&nbsp;&nbsp; the scripting language) that is automatically loaded on startup.<br>
&nbsp;&nbsp;&nbsp;&nbsp; Examples: file explorer, network editing, enhanced autocompletion,<br>
&nbsp;&nbsp;&nbsp;&nbsp; syntax checks.<br>
&nbsp;&nbsp;&nbsp;&nbsp; More are being developed and shared on VimOnline all the time.</div>
<br>
&nbsp;&nbsp;Syntax highlighting for many programming languages<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Syntax highlighting (including concealing items) for hundreds of<br>
&nbsp;&nbsp;&nbsp;&nbsp; programming languages is supported. Support for others can be<br>
&nbsp;&nbsp;&nbsp;&nbsp; added.</div>
<br>
&nbsp;&nbsp;Extended regular expressions<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim supports extended regular expressions which are similar in<br>
&nbsp;&nbsp;&nbsp;&nbsp; functionality to that of Perl regular expressions.</div>
<br>
&nbsp;&nbsp;Integrated Spell checking<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Spell checking has been integrated into Vim&nbsp;</div>
<br>
&nbsp;&nbsp;Diff mode<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim can highlight the differences between two, three or four files.<br>
&nbsp;&nbsp;&nbsp;&nbsp; Identical lines will be folded away and hidden.</div>
<br>
&nbsp;&nbsp;Encryption using the blowfish algorithm<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim allows to encrypt your files using the symmetric block cipher<br>
&nbsp;&nbsp;&nbsp;&nbsp; blowfish as well as the swap file.</div>
<br>
&nbsp;&nbsp;Extensive customizable<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim can be tuned and customized to work like you want by setting<br>
&nbsp;&nbsp;&nbsp;&nbsp; options. You can define your own commands, macros and even plugins<br>
&nbsp;&nbsp;&nbsp;&nbsp; to extend its capabilities</div>
<br>
&nbsp;&nbsp;Packages<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Packages have been added to keep the installation of the growing<br>
&nbsp;&nbsp;&nbsp;&nbsp; number of plugins manageable. This is a convenient way to get one<br>
&nbsp;&nbsp;&nbsp;&nbsp; or more plugins, drop them in a directory and keep them updated.<br>
&nbsp;&nbsp;&nbsp;&nbsp; Vim will load them automatically, or only when desired.</div>
<br>
Programming performance features:<br>
<br>
&nbsp;&nbsp;Edit-compile-edit speedup<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; You can compile within Vim and automatically jump to the location of<br>
&nbsp;&nbsp;&nbsp;&nbsp; errors in the source code.</div>
<br>
&nbsp;&nbsp;Indenting for many programming languages<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; C, C++, Java, Perl, XML and many other languages can be automatically<br>
&nbsp;&nbsp;&nbsp;&nbsp; indented by vim while you type.&nbsp;&nbsp;Support for others can be added.</div>
<br>
&nbsp;&nbsp;Searching for words in include files<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim allows you to search for a match of the word under the cursor in<br>
&nbsp;&nbsp;&nbsp;&nbsp; the current and included files.</div>
<br>
&nbsp;&nbsp;Advanced text objects<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Instantly select, delete, copy, indent, format, change case, or ...<br>
&nbsp;&nbsp;&nbsp;&nbsp; to all the text between ( and ), or { and }, or &lt; and &gt;, or [ and<br>
&nbsp;&nbsp;&nbsp;&nbsp; ].&nbsp;&nbsp;Or a word, sentence, or paragraph.&nbsp;&nbsp;Very powerful.</div>
<br>
&nbsp;&nbsp;Folding<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Certain parts of the text can be &quot;folded&quot; away.&nbsp;&nbsp;The best example is<br>
&nbsp;&nbsp;&nbsp;&nbsp; the body of a function.&nbsp;&nbsp;You can get an overview of the code, and then<br>
&nbsp;&nbsp;&nbsp;&nbsp; open the fold of the function whose detail you need to see.</div>
<br>
&nbsp;&nbsp;ctags and cscope integration<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Using these two powerful programs, you can jump to a definition of a<br>
&nbsp;&nbsp;&nbsp;&nbsp; function from a calling instance of it, and use other tricks to<br>
&nbsp;&nbsp;&nbsp;&nbsp; navigate source code.</div>
<br>
&nbsp;&nbsp;Integration of several programming languages<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; If you find the internal scripting language not powerful enough, you<br>
&nbsp;&nbsp;&nbsp;&nbsp; can extend Vim using Lua, Ruby, Tcl, Perl and Python 2 and 3.</div>
<br>
&nbsp;&nbsp;Asynchronous I/O support<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Vim uses jobs and channels to talk to other programs<br>
&nbsp;&nbsp;&nbsp;&nbsp; asynchronously. This allows to have e.g. a compiler run in the<br>
&nbsp;&nbsp;&nbsp;&nbsp; background and open the quickfix list as soon as it is finished to<br>
&nbsp;&nbsp;&nbsp;&nbsp; fix warnings and errors.</div>
<br>
&nbsp;&nbsp;Timers<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; Timers are asynchronous and can fire once or repeatedly to invoke a<br>
&nbsp;&nbsp;&nbsp;&nbsp; function to do any work.</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="vi_diff.html#vi-differences">vi-differences</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-1.5" name="faq-1.5">faq-1.5</a><br>
1.5. Is Vim free?<br>
<br>
Vim is Charityware. There are no restrictions on using or copying Vim, but<br>
the author encourages you to make a donation to charity. A document<br>
explaining how to do so is included in the distribution.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="uganda.html#copyright">copyright</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2" name="faq-2">faq-2</a><br>
SECTION 2 - RESOURCES<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.1" name="faq-2.1">faq-2.1</a><br>
2.1. Where can I learn more about Vim?<br>
<br>
You can post your Vim questions to the vim@vim.org mailing list.&nbsp;&nbsp;You can<br>
post your Vim development related questions to the vim-dev@vim.org mailing<br>
list. Vim does not have a newsgroup of its own. But the appropriate<br>
newsgroup to post to is comp.editors.<br>
<br>
&quot;VimOnline&quot; is a web page that serves as a de facto homepage for vim,<br>
although the main purpose of it is to gather tips and scripts from<br>
everywhere.&nbsp;&nbsp;Get involved!&nbsp;&nbsp;The URL is vim.sourceforge.net or vim.sf.net.<br>
<br>
Finally, read the Vi FAQ:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.faqs.org/faqs/editor-faq/vi/part1/index.html">http://www.faqs.org/faqs/editor-faq/vi/part1/index.html</a></div>
<br>
Finally, there are also some communities, where you can discuss features<br>
or ask questions:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vi.stackexchange.com">http://vi.stackexchange.com</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vim.reddit.com">http://vim.reddit.com</a></div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#mail-list">mail-list</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#internet">internet</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.2" name="faq-2.2">faq-2.2</a><br>
2.2. Is there a mailing list available?<br>
<br>
There are several:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;NAME&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DESCRIPTION</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;vim-announce&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Announcements of new releases<br>
&nbsp;&nbsp;&nbsp;&nbsp;vim&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; General discussion<br>
&nbsp;&nbsp;&nbsp;&nbsp;vim-dev&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Patches, bug reports, development discussions<br>
&nbsp;&nbsp;&nbsp;&nbsp;vim-mac&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Macintosh discussion<br>
&nbsp;&nbsp;&nbsp;&nbsp;vim-fr&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;General discussion in French<br>
<br>
Of these, only vim and vim-dev are of general interest. vim-announce is<br>
read-only to most people, and its messages are sent to the other lists as<br>
well. The remaining four are very low volume.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;To subscribe:&nbsp;&nbsp; send an email to &lt;NAME&gt;-subscribe@vim.org<br>
&nbsp;&nbsp;&nbsp;&nbsp;To unsubscribe: send an email to &lt;NAME&gt;-unsubscribe@vim.org<br>
&nbsp;&nbsp;&nbsp;&nbsp;To get help:&nbsp;&nbsp;&nbsp;&nbsp;send an email to &lt;NAME&gt;-help@vim.org</div>
<br>
The available mailing lists are also mentioned here:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.vim.org/maillist.php">http://www.vim.org/maillist.php</a></div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Constant" href="vim_faq.html#faq-2.3" name="faq-2.3">faq-2.3</a><br>
2.3. Is there an archive available for the Vim mailing lists?<br>
<br>
Yes. Visit&nbsp;<span class="Constant"><a href="http://www.yahoogroups.com/list/">http://www.yahoogroups.com/list/</a></span><span class="Special">&lt;name&gt;</span>, where name is one of:<br>
vimannounce, vim, vimdev, vim-fr, vim-mac, vim-vms.<br>
<br>
Alternatively, visit&nbsp;<span class="Constant">www.gmane.org</span>&nbsp;to find out about GMANE, which allows<br>
you to access the mailing lists as though they were newsgroups.&nbsp;&nbsp;This<br>
offers some convenience to those who wish to browse the history or casually<br>
observe the current threads.<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.4" name="faq-2.4">faq-2.4</a><br>
2.4. Where can I get the Vim user manual in HTML/PDF/PS format?<br>
<br>
You can download the HTML/PDF/PS format of the Vim user manual from:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vimdoc.sourceforge.net/">http://vimdoc.sourceforge.net/</a></div>
<br>
<span class="Todo">Note</span>, the user manual from that page is currently pretty outdated. It's<br>
best to either use the documentation that comes with vim or use the<br>
online version at&nbsp;<span class="Constant"><a href="http://vimhelp.appspot.com">http://vimhelp.appspot.com</a></span><br>
<br>
You can find a pdf version of the full English help, including this faq<br>
(in letter, A4 and Ipad format) at:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.nathangrigg.net/vimhelp/">http://www.nathangrigg.net/vimhelp/</a></div>
<br>
This document is cross-referenced, so you can use the hyperlink<br>
functionality.<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.5" name="faq-2.5">faq-2.5</a><br>
2.5. I have a &quot;xyz&quot; (some) problem with Vim. How do I determine if it is a<br>
&nbsp;&nbsp;&nbsp;&nbsp; problem with my setup or with Vim?&nbsp;&nbsp;/ Have I found a bug in Vim?<br>
<br>
First, you need to find out, whether the error is in the actual runtime<br>
files or any plugin that is distributed with Vim or whether it is a<br>
simple side effect of any configuration option from your .vimrc or<br>
.gvimrc. So first, start vim like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;vim -u NONE -U NONE -N -i NONE</div>
<br>
This starts Vim in nocompatible mode (-<span class="Special">N</span>), without reading your viminfo<br>
file (-i NONE), without reading any configuration file (-u NONE for not<br>
reading .vimrc file and -U NONE for not reading a .gvimrc file) or even<br>
plugin.<br>
<br>
In this invocation, try to reproduce your problem. If the error<br>
persists, the chance is good you've found a bug in Vim (see also<br>
Question 2.6.&nbsp;<a class="Identifier" href="vim_faq.html#faq-2.6">faq-2.6</a>)<br>
<br>
If the error does not occur when starting Vim this way, then the problem<br>
is either related to some plugin of yours or some setting in one of your<br>
local setup files. You need to find out, what triggers the error, you<br>
try starting Vim this way:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;vim -u NONE -U NONE -N</div>
<br>
If the error occurs, the problem is your .viminfo file. Simply delete<br>
the viminfo file then. If the error does not occur, try:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;vim -u ~/.vimrc --noplugin -N -i NONE</div>
<br>
This will simply use your .vimrc as configuration file, but not load any<br>
plugins. If the error occurs this time, the error is possibly caused by<br>
some configuration option inside your .vimrc file. Depending on the<br>
length of your vimrc file, it can be quite hard to trace the origin<br>
within that file.<br>
<br>
The best way is to add :finish command in the middle of your .vimrc.<br>
Then restart again using the same command line. If the error still<br>
occurs, the bug must be caused because of a setting in the first half of<br>
your .vimrc. If it doesn't happen, the problematic setting must be in<br>
the second half of your .vimrc. So move the :finish command to the<br>
middle of that half, of which you know that triggers the error and move<br>
your way along, until you find the problematic option. If your .vimrc is<br>
350 lines long, you need at a maximum 9 tries to find the offending line<br>
(in practise, this can often be further reduced, since often lines<br>
depend on each other).<br>
<br>
If the problem does not occur, when only loading your .vimrc file, the<br>
error must be caused by a plugin or another runtime file (indent<br>
autoload or syntax script). Check the output of the :scriptnames command<br>
to see what files have been loaded and for each one try to disable each<br>
one by one and see which one triggers the bug. Often files that are<br>
loaded by vim, have a simple configuration variable to disable them, but<br>
you need to check inside each file separately.<br>
<br>
You can also use the -V command line argument to get more debug<br>
information to analyze the problem:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -V2logfile</div>
<br>
You can increase the value passed to the -V argument to get more debug<br>
information. By also specifying a logfile name, this makes sure, the<br>
debug messages don't appear on the screen and won't disturb you when<br>
trying to reproduce the problem.<br>
<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-u">-u</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-U">-U</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-N">-N</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-V">-V</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'verbose'">'verbose'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:verbose">:verbose</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:set-verbose">:set-verbose</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.6" name="faq-2.6">faq-2.6</a><br>
2.6. Where can I report bugs?<br>
<br>
First collect the required information using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:source $VIMRUNTIME/bugreport.vim</div>
<br>
Now send the resulting text from the above command to the bugs@vim.org<br>
e-mail address. There is also a public bug tracker available at<br>
<span class="Constant"><a href="http://code.google.com/p/vim/issues/list">http://code.google.com/p/vim/issues/list</a></span>. A copy of each message there<br>
will be forwarded to the Vim Development list.<br>
<br>
The Vim Development mailing list (see Question 2.2&nbsp;<a class="Identifier" href="vim_faq.html#faq-2.2">faq-2.2</a>) is a good place to<br>
discuss general bugs.&nbsp;&nbsp;If the bug you find is with syntax highlighting,<br>
a runtime file, or some other &quot;added feature&quot; (i.e. not directly<br>
programmed into vim), attempt to inform the maintainer of that feature.<br>
His e-mail address will be mentioned at the top of the corresponding<br>
runtime file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#bug-reports">bug-reports</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.7" name="faq-2.7">faq-2.7</a><br>
2.7. Where can the FAQ be found?<br>
<br>
The FAQ can be found at&nbsp;<span class="Constant"><a href="http://vimhelp.appspot.com/vim_faq.txt.html">http://vimhelp.appspot.com/vim_faq.txt.html</a></span>.<br>
It will be auto-generated from the source that is managed in the github<br>
repository&nbsp;<span class="Constant"><a href="http://www.github.com/chrisbra/vim_faq">http://www.github.com/chrisbra/vim_faq</a></span>&nbsp;(Patches are welcome).<br>
<br>
The repository also includes the faq in different formats, e.g. manpage,<br>
pdf file, html file, plain text version and a version in vim help format.<br>
<br>
A slightly older version (which doesn't seem to get updated anymore) can<br>
still be found at VimOnline (vim.sf.net).&nbsp;<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.8" name="faq-2.8">faq-2.8</a><br>
2.8. What if I don't find an answer in this FAQ?<br>
<br>
This FAQ covers mainly Vim-specific questions. You may find more<br>
information suitable for most Vi clones by reading the Vi FAQ. It is posted<br>
regularly on comp.editors. You can also find a copy at<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.faqs.org/faqs/editor-faq/vi/part1/index.html">http://www.faqs.org/faqs/editor-faq/vi/part1/index.html</a></div>
<br>
Also, since Vim has gathered so many features in the last few years,<br>
successfully documenting the frequently asked questions here is a<br>
near-impossible task. To make it possible, please email the maintainer if<br>
you have a good question. A good question is one that you've tried to<br>
answer yourself (remember, Vim has great documentation) but struggled.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.9" name="faq-2.9">faq-2.9</a><br>
2.9. I have a patch for implementing a Vim feature. Where can I send this<br>
&nbsp;&nbsp;&nbsp;&nbsp; patch?<br>
<br>
You can send your patches to the Vim developer mailing list<br>
vim-dev@vim.org.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#vim-dev">vim-dev</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-2.10" name="faq-2.10">faq-2.10</a><br>
2.10. I have a Vim tip or developed a new Vim syntax/indent/filetype/<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compiler plugin or developed a new script or a colorscheme.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is there a public website where I can upload this?<br>
<br>
Yes. You can use the Vim Online website to upload your plugins/scripts,<br>
colorschemes, etc. The site is at&nbsp;<span class="Constant"><a href="http://vim.sourceforge.net">http://vim.sourceforge.net</a></span><br>
Nowadays people also seem to share their plugins/runtime files at<br>
github.<br>
<br>
Tips can also be shared in the Wiki which you can find at<br>
<span class="Constant"><a href="http://vim.wikia.com">http://vim.wikia.com</a></span><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-3" name="faq-3">faq-3</a><br>
SECTION 3 - AVAILABILITY<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-3.1" name="faq-3.1">faq-3.1</a><br>
3.1. What is the latest version of Vim?<br>
<br>
The latest version of Vim is 7.4 released on 10th August 2013.<br>
<br>
The release-history of different versions of Vim is below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;Version 8.0&nbsp;&nbsp;&nbsp;&nbsp; 12th September, 2016<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 7.4&nbsp;&nbsp;&nbsp;&nbsp; 10th August, 2013<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 7.3&nbsp;&nbsp;&nbsp;&nbsp; 15th August, 2010<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 7.2&nbsp;&nbsp;&nbsp;&nbsp; 9th August, 2008<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 7.1&nbsp;&nbsp;&nbsp;&nbsp; 12th May, 2007<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 7.0&nbsp;&nbsp;&nbsp;&nbsp; 8th May, 2006<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 6.4&nbsp;&nbsp;&nbsp;&nbsp; 15th October, 2005<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 6.3&nbsp;&nbsp;&nbsp;&nbsp; 8th June 2004<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 6.2&nbsp;&nbsp;&nbsp;&nbsp; 1st June 2003<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 6.1&nbsp;&nbsp;&nbsp;&nbsp; 24th March 2002<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 6.0&nbsp;&nbsp;&nbsp;&nbsp; 27th September, 2001<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.8&nbsp;&nbsp;&nbsp;&nbsp; 31st May, 2001<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.7&nbsp;&nbsp;&nbsp;&nbsp; 24th June, 2000<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.6&nbsp;&nbsp;&nbsp;&nbsp; 16th January, 2000<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.5&nbsp;&nbsp;&nbsp;&nbsp; 21st September, 1999<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.4&nbsp;&nbsp;&nbsp;&nbsp; 26th July, 1999<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.3&nbsp;&nbsp;&nbsp;&nbsp; 31st August, 1998<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.2&nbsp;&nbsp;&nbsp;&nbsp; 24th August, 1998<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.1&nbsp;&nbsp;&nbsp;&nbsp; 7th April, 1998<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 5.0&nbsp;&nbsp;&nbsp;&nbsp; 19th February, 1998<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 4.6&nbsp;&nbsp;&nbsp;&nbsp; 13th March,1997<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 4.5&nbsp;&nbsp;&nbsp;&nbsp; 17th October, 1996<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 4.2&nbsp;&nbsp;&nbsp;&nbsp; 5th July,1996<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 4.0&nbsp;&nbsp;&nbsp;&nbsp; 21st May, 1996<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 3.0&nbsp;&nbsp;&nbsp;&nbsp; 16th August, 1994<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 2.0&nbsp;&nbsp;&nbsp;&nbsp; 21st December, 1993<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 1.27&nbsp;&nbsp;&nbsp;&nbsp;23rd April, 1993<br>
&nbsp;&nbsp;&nbsp;&nbsp;Version 1.17&nbsp;&nbsp;&nbsp;&nbsp;21st April, 1992</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version5.html#new-5">new-5</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version6.html#new-6">new-6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version7.html#new-7">new-7</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version8.html#new-8">new-8</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version7.html#changed-7.1">changed-7.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version7.html#changed-7.2">changed-7.2</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version7.html#changed-7.3">changed-7.3</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version7.html#changed-7.4">changed-7.4</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-3.2" name="faq-3.2">faq-3.2</a><br>
3.2. Where can I find the latest version of Vim?<br>
<br>
You can download the sources for the latest version of Vim from the<br>
Github repository. The URL for this site is<br>
<span class="Constant"><a href="https://github.com/vim/vim">https://github.com/vim/vim</a></span><br>
<br>
A mirror is available at bitbucket:<br>
<span class="Constant"><a href="https://bitbucket.org/vim-mirror/vim">https://bitbucket.org/vim-mirror/vim</a></span><br>
<br>
Some users keep updated repositories for distributing latest binary<br>
versions of Vim. You can find those repositories here:<br>
<br>
<span class="Constant"><a href="http://vim.wikia.com/wiki/Where_to_download_Vim">http://vim.wikia.com/wiki/Where_to_download_Vim</a></span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-3.3" name="faq-3.3">faq-3.3</a><br>
3.3. What platforms does it run on?<br>
<br>
All Unix platforms.<br>
All Windows platforms.<br>
Amiga, Atari, BeOS, DOS, Macintosh, MachTen, OS/2, RiscOS, VMS, IBM z/OS.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-3.4" name="faq-3.4">faq-3.4</a><br>
3.4. Where can I download the latest version of the Vim runtime files?<br>
<br>
You can download the latest version of the Vim runtime files (syntax files,<br>
filetype plugins, compiler files, color schemes, documentation, indentation<br>
files and keymaps) from the Vim ftp site from the<br>
<span class="Constant">ftp://ftp.vim.org/pub/vim/runtime</span>&nbsp;directory.<br>
<br>
Alternatively, the runtime files can be downloaded from the git<br>
repository that holds Vim source code at:<br>
<span class="Constant"><a href="https://github.com/vim/vim/tree/master/runtime">https://github.com/vim/vim/tree/master/runtime</a></span><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4" name="faq-4">faq-4</a><br>
SECTION 4 - HELP<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.1" name="faq-4.1">faq-4.1</a><br>
4.1. How do I use the help files?<br>
<br>
Help can be found for all functions of Vim. In order to use it, use the<br>
&quot;:help&quot; command.&nbsp;&nbsp;This will bring you to the main help page. On that first<br>
page, you will find explanations on how to move around. Basically, you move<br>
around in the help pages the same way you would in a read-only document.<br>
You can jump to specific subjects by using tags. This can be done in two<br>
ways:<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;</span>* Use the &quot;&lt;Ctrl-]&gt;&quot; command while standing on the name of a command<br>
&nbsp;&nbsp;&nbsp;&nbsp; or option. This only works when the tag is a keyword.<br>
&nbsp;&nbsp;&nbsp;&nbsp; &quot;<span class="Special">&lt;Ctrl-LeftMouse&gt;</span>&quot; and &quot;g<span class="Special">&lt;LeftMouse&gt;</span>&quot; work just like &quot;&lt;Ctrl-]&gt;&quot;.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;</span>* use the &quot;:tag&nbsp;<span class="Special">&lt;subject&gt;</span>&quot; command. This works with all characters.<br>
<br>
Use &quot;<span class="Special">&lt;Ctrl-T&gt;</span>&quot; to jump back to previous positions in the help files. Use<br>
&quot;:q&quot; to close the help window.<br>
<br>
If you want to jump to a specific subject on the help pages, use &quot;:help<br>
<span class="Special">{subject}</span>&quot;. If you don't know what to look for, try &quot;:help index&quot; to get a<br>
list of all available subjects. Use the standard search keys to locate the<br>
information you want. You can abbreviate the &quot;:help&quot; command as &quot;:h&quot;.<br>
<br>
For searching the help, see the next Question 4.2.&nbsp;<a class="Identifier" href="vim_faq.html#faq-4.2">faq-4.2</a><br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="helphelp.html#online-help">online-help</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.2" name="faq-4.2">faq-4.2</a><br>
4.2. How do I search for a keyword in the Vim help files?<br>
<br>
a)&nbsp;&nbsp;You can press the&nbsp;<span class="Special">CTRL-D</span>&nbsp;key after typing the help keyword to get a<br>
&nbsp;&nbsp;&nbsp;&nbsp;list of all the help keywords containing the supplied pattern. You can<br>
&nbsp;&nbsp;&nbsp;&nbsp;also use the meta characters like *, \+, etc to specify the help<br>
&nbsp;&nbsp;&nbsp;&nbsp;search pattern:&nbsp;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:help init&lt;C-D&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:help str*()&lt;C-D&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:help '*indent&lt;C-D&gt;</div>
<br>
b)&nbsp;&nbsp;You can press the Tab key after typing a partial help keyword to expand<br>
&nbsp;&nbsp;&nbsp;&nbsp;to the matching keyword. You can continue to press the Tab key to see<br>
&nbsp;&nbsp;&nbsp;&nbsp;other keyword matches.<br>
<br>
c)&nbsp;&nbsp;From the help window, you can use the &quot;:tag&quot; command to search for<br>
&nbsp;&nbsp;&nbsp;&nbsp;keywords. For example,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:tselect /window</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;This command will list all the help keywords containing the text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&quot;window&quot;. You can select one from the list and jump to it.<br>
<br>
d)&nbsp;&nbsp;You can use the &quot;:helpgrep&quot; command to search for the given text in<br>
&nbsp;&nbsp;&nbsp;&nbsp;all the help files. The quickfix window will be opened with all the<br>
&nbsp;&nbsp;&nbsp;&nbsp;matching lines.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_02.html#help-summary">help-summary</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_CTRL-D">c_CTRL-D</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_<Tab>">c_&lt;Tab&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tagsrch.html#:tselect">:tselect</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="helphelp.html#:help">:help</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="helphelp.html#:helpgrep">:helpgrep</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.3" name="faq-4.3">faq-4.3</a><br>
4.3. I am getting an error message E123, what did I do wrong?<br>
<br>
You can get more information about the error and the error message using:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#E123">E123</a><br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#error-messages">error-messages</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.4" name="faq-4.4">faq-4.4</a><br>
4.4. Where can I read about the various modes in Vim?<br>
<br>
You can get information about the different modes in Vim by reading&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#vim-modes">vim-modes</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.5" name="faq-4.5">faq-4.5</a><br>
4.5. How do I generate the Vim help tags file after adding a new Vim help<br>
&nbsp;&nbsp;&nbsp;&nbsp; file?<br>
<br>
You can use the &quot;:helptags&quot; command to regenerate the Vim help tag file<br>
from within Vim. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:cd $VIMRUNTIME/doc<br>
&nbsp;&nbsp;&nbsp;&nbsp;:helptags .</div>
<br>
To update all &quot;doc&quot; directories in your&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>, you can use&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;:helptags ALL<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="helphelp.html#:helptags">:helptags</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#add-local-help">add-local-help</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-4.6" name="faq-4.6">faq-4.6</a><br>
4.6. Can I use compressed versions of the help files?<br>
<br>
Yes. You can compress the help files and still be able to view them with<br>
Vim.&nbsp;&nbsp;This makes accessing the help files a bit slower and requires the<br>
&quot;gzip&quot; utility. Follow these steps to compress and use the Vim help files:<br>
<br>
- Compress all the help files using &quot;gzip doc/*.txt&quot;.<br>
<br>
- Edit the &quot;doc/tags&quot; file and change the &quot;.txt&quot; to &quot;.txt.gz&quot; using<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:%s=\(\t.*\.txt\)\t=\1.gz\t=<br>
<br>
- Add the following line to your vimrc:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set helpfile=<span class="Special">{dirname}</span>/help.txt.gz<br>
<br>
Where&nbsp;<span class="Special">{dirname}</span>&nbsp;is the directory where the help files are.&nbsp;&nbsp;The gzip.vim<br>
plugin supplied with the standard Vim distribution will take care of<br>
decompressing the files.&nbsp;&nbsp;You must make sure that $VIMRUNTIME is set to<br>
where the other Vim files are, when they are not in the same location as<br>
the compressed &quot;doc&quot; directory.<br>
<br>
<span class="Todo">Note</span>, that the :helpgrep command does not work with compressed help pages.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#gzip-helpfile">gzip-helpfile</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'helpfile'">'helpfile'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pi_gzip.html#gzip">gzip</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#$VIMRUNTIME">$VIMRUNTIME</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5" name="faq-5">faq-5</a><br>
SECTION 5 - EDITING A FILE<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.1" name="faq-5.1">faq-5.1</a><br>
5.1. How do I load a file in Vim for editing?<br>
<br>
There are several ways to load a file for editing. The simplest is to<br>
use the &quot;:e&quot; (:edit) command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e &lt;filename&gt;</div>
<br>
You can also use the &quot;:n&quot; (:next) command to load files into Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:n &lt;filename(s)&gt;</div>
<br>
You can also use the &quot;:args&quot; command to load files into Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:args &lt;filename(s)&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html">usr_07.txt</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#edit-files">edit-files</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:edit">:edit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:next_f">:next_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:args_f">:args_f</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.2" name="faq-5.2">faq-5.2</a><br>
5.2. How do I save the current file in another name (save as) and edit a<br>
&nbsp;&nbsp;&nbsp;&nbsp; new file?<br>
<br>
You can use the &quot;:saveas&quot; command to save the current file in another name:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:saveas &lt;newfilename&gt;</div>
<br>
Alternatively, you can also use the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:w &lt;newfilename&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:edit #</div>
<br>
You can also use the &quot;:file&quot; command, followed by &quot;:w&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:file &lt;newfilename&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:w</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.7">07.7</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:saveas">:saveas</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:file_f">:file_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:w">:w</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.3" name="faq-5.3">faq-5.3</a><br>
5.3. How do I change the current directory to the directory of the current<br>
&nbsp;&nbsp;&nbsp;&nbsp; file?<br>
<br>
You can use the following command to change the current directory to the<br>
directory of the current file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:cd %:p:h</div>
<br>
To automatically change the current directory to the directory of the<br>
current file, simply set the option&nbsp;<a class="Type" href="options.html#'autochdir'">'autochdir'</a>.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set autochdir</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:cd">:cd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:lcd">:lcd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#filename-modifiers">filename-modifiers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#autocommand">autocommand</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'acd'">'acd'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#getcwd()">getcwd()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.4" name="faq-5.4">faq-5.4</a><br>
5.4. How do I write a file without the line feed (EOL) at the end of the<br>
&nbsp;&nbsp;&nbsp;&nbsp; file?<br>
<br>
You can turn off the&nbsp;<a class="Type" href="options.html#'eol'">'eol'</a>&nbsp;option and turn on the&nbsp;<a class="Type" href="options.html#'binary'">'binary'</a>&nbsp;option to write<br>
a file without the EOL at the end of the file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set binary<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set noeol<br>
&nbsp;&nbsp;&nbsp;&nbsp;:w</div>
<br>
Alternatively, you can use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set noeol<br>
&nbsp;&nbsp;&nbsp;&nbsp;:w ++bin</div>
<br>
If you rather only like Vim not to write missing EOLs, you can reset the<br>
<a class="Type" href="options.html#'fixeol'">'fixeol'</a>&nbsp;option. This needs a Vim newer 7.4.785, so you should wrap this<br>
in an if condition in your .vimrc like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if exists('+fixeol')<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set nofixeol<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
This has the advantage of avoiding the many side effects that the<br>
<a class="Type" href="options.html#'binary'">'binary'</a>&nbsp;option has.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'endofline'">'endofline'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fixeol'">'fixeol'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'binary'">'binary'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_23.html#23.4">23.4</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.5" name="faq-5.5">faq-5.5</a><br>
5.5. How do I configure Vim to open a file at the last edited location?<br>
<br>
Vim stores the cursor position of the last edited location for each buffer<br>
in the '&quot;' register. You can use the following autocmd in your .vimrc or<br>
.gvimrc file to open a file at the last edited location:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;au BufReadPost * if line(&quot;'\&quot;&quot;) &gt; 0 &amp;&amp; line(&quot;'\&quot;&quot;) &lt;= line(&quot;$&quot;) |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \ exe &quot;normal! g`\&quot;&quot; | endif</div>
<br>
Alternatively, you can simply source the vimrc_example.vim file, which is<br>
distributed with Vim.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'quote">'quote</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#last-position-jump">last-position-jump</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#vimrc_example.vim">vimrc_example.vim</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.6" name="faq-5.6">faq-5.6</a><br>
5.6. When editing a file in Vim, which is being changed by an external<br>
&nbsp;&nbsp;&nbsp;&nbsp; application, Vim opens a warning window (like the confirm dialog) each<br>
&nbsp;&nbsp;&nbsp;&nbsp; time a change is detected. How do I disable this warning?<br>
<br>
You can set the Vim&nbsp;<a class="Type" href="options.html#'autoread'">'autoread'</a>&nbsp;option to automatically read the file again<br>
when it is changed outside of Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set autoread</div>
<br>
You can also use the following autocommand:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;autocmd FileChangedShell *<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ echohl WarningMsg |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ echo &quot;File has been changed outside of vim.&quot; |<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\ echohl None</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'autoread'">'autoread'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FileChangedShell">FileChangedShell</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#timestamp">timestamp</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:checktime">:checktime</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.7" name="faq-5.7">faq-5.7</a><br>
5.7. How do I edit a file whose name is under the cursor?<br>
<br>
You can use the gf command to edit a file whose name is under the cursor.<br>
You can use the&nbsp;<span class="Special">CTRL-W</span>&nbsp;f command to edit the file in a new window and<br>
finally you can use&nbsp;<span class="Special">CTRL-W</span>&nbsp;gf top open a new tab page that contains the<br>
file name under the cursor.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#gf">gf</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#CTRL-W_f">CTRL-W_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#CTRL-W_gf">CTRL-W_gf</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'isfname'">'isfname'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'path'">'path'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'suffixesadd'">'suffixesadd'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'includeexpr'">'includeexpr'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.8" name="faq-5.8">faq-5.8</a><br>
5.8. How do I reload/re-edit the current file?<br>
<br>
You can use the &quot;:edit&quot; command, without specifying a file name, to reload<br>
the current file.&nbsp;&nbsp;If you have made modifications to the file, you can use<br>
&quot;:edit!&quot; to force the reload of the current file (you will lose your<br>
modifications, but depending on your&nbsp;<a class="Type" href="options.html#'undoreload'">'undoreload'</a>&nbsp;settings, those<br>
changes might be saved into the undo history).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:edit">:edit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:edit!">:edit!</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'confirm'">'confirm'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'undoreload'">'undoreload'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.9" name="faq-5.9">faq-5.9</a><br>
5.9. How do I autosave a file periodically?<br>
<br>
Vim doesn't support auto-saving a file periodically.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'updatetime'">'updatetime'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#CursorHold">CursorHold</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="recover.html#swap-file">swap-file</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.10" name="faq-5.10">faq-5.10</a><br>
5.10. How do I open a file in read-only mode?<br>
<br>
You can open a file in read-only mode using the &quot;:view&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:view &lt;filename&gt;</div>
<br>
This command sets the&nbsp;<a class="Type" href="options.html#'readonly'">'readonly'</a>&nbsp;option for the opened buffer. You can also<br>
use the &quot;-R&quot; command-line option to open a file in read-only mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -R &lt;filename&gt;</div>
<br>
You can also use the symbolic link executable &quot;view&quot; to open a file in<br>
read-only mode from the command-line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ view &lt;filename&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.6">07.6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'readonly'">'readonly'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'modifiable'">'modifiable'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:view">:view</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:sview">:sview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#view">view</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-R">-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-M">-M</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.11" name="faq-5.11">faq-5.11</a><br>
5.11. How do I open a file for editing without saving the modifications to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the current file?<br>
<br>
You can open a file for editing without saving the modifications to the<br>
current file and without losing the changes using one of the following<br>
methods:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:split &lt;new_filename&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:new &lt;new_filename&gt;</div>
<br>
You can also set the&nbsp;<a class="Type" href="options.html#'hidden'">'hidden'</a>&nbsp;option and edit a new file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set hidden<br>
&nbsp;&nbsp;&nbsp;&nbsp;:e &lt;new_filename&gt;</div>
<br>
If you want to discard the changes made to the current file and load<br>
another file for editing, then you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e! &lt;new_filename&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:edit!_f">:edit!_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'hidden'">'hidden'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:split">:split</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:new">:new</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-5.12" name="faq-5.12">faq-5.12</a><br>
5.12. How do I reduce the loading time for very large files in Vim?<br>
<br>
You can use the following settings to reduce the loading time for<br>
very large files in Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set lazyredraw<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set noswapfile<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set undolevels=-1<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set eventignore=all<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set nohidden<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set syntax=off</div>
<br>
<span class="Todo">Note</span>&nbsp;that the above settings will disable many Vim features including the<br>
following: Swap files support for crash recovery, undo support, syntax<br>
highlighting, filetype detection and other autocommand based features.<br>
<br>
There is also the LargeFile plugin available at<br>
<span class="Constant"><a href="http://www.vim.org/scripts/script.php?script_id=1506">http://www.vim.org/scripts/script.php?script_id=1506</a></span><br>
which automatically sets these options, when working with large files<br>
(it is configurable, what is considered to be a large file, by default,<br>
it is 100MB).<br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6" name="faq-6">faq-6</a><br>
SECTION 6 - EDITING MULTIPLE FILES<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.1" name="faq-6.1">faq-6.1</a><br>
6.1. How do I open multiple files at once from within Vim?<br>
<br>
Make a difference between args, buffers, tabs and windows. They are all<br>
different things in VIM.<br>
<br>
args is a list of arguments. Buffers are place to edit text, almost<br>
always attached to a file but not necessarily. Window is a place for a<br>
buffer and tab is set of windows, better name would be&nbsp;<span class="MissingTag">'layout'</span>.<br>
<br>
There are several ways to open multiple files at once from within Vim. You<br>
can use the &quot;:next&quot; command to specify a group of files:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:next f1.txt f2.txt<br>
&nbsp;&nbsp;&nbsp;&nbsp;:next *.c</div>
<br>
You can use the :args command to specify a group of files as arguments:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:args f1.txt f2.txt<br>
&nbsp;&nbsp;&nbsp;&nbsp;:args *.c</div>
<br>
After loading the files, you can use the &quot;:next&quot; and &quot;:prev&quot; command to<br>
switch between the files.<br>
<br>
To execute command for all files in argument-list use &quot;:argdo&quot;<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.2">07.2</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:next">:next</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:args_f">:args_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#argument-list">argument-list</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.2" name="faq-6.2">faq-6.2</a><br>
6.2. How do I switch between multiple files/buffers in Vim?<br>
<br>
To list all buffers use &quot;:ls&quot;, to list buffers without file attached to<br>
(also known as unlisted buffers, ex. scratch buffer and help-window) use<br>
&quot;:ls!&quot;<br>
<br>
There are several ways to switch between multiple files. You can use the<br>
&quot;:buffer&quot; command to switch between multiple files. You can also shorten<br>
command as &quot;:b&quot; and use only part of the filename. For example,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:buffer file1<br>
&nbsp;&nbsp;&nbsp;&nbsp;:buffer file2<br>
&nbsp;&nbsp;&nbsp;&nbsp;:b e2</div>
<br>
You can also use&nbsp;<span class="Special">&lt;TAB&gt;</span>&nbsp;after &quot;:b&quot; for autocompletion. Try also &quot;:b&quot;<br>
followed by&nbsp;<span class="Special">&lt;CTRL-d&gt;</span>&nbsp;to see all available buffers. This works also for<br>
&quot;:e&quot;.<br>
<br>
You can also use the&nbsp;<span class="Special">CTRL-^</span>&nbsp;key to switch between buffers. By specifying a<br>
count before pressing the key, you can edit the buffer with that number.<br>
Without the count, you can edit the alternate buffer by pressing&nbsp;<span class="Special">CTRL-^</span><br>
<br>
You can also use the &quot;:e #&quot; command to edit a particular buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e #5</div>
<br>
To close a buffer use &quot;:bd&quot; -command.<br>
<br>
To execute command for all files in buffer-list use &quot;:bufdo&quot;<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#edit-files">edit-files</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:buffer">:buffer</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#CTRL-^">CTRL-^</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#alternate-file">alternate-file</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_22.html#22.4">22.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.3">07.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.3" name="faq-6.3">faq-6.3</a><br>
6.3. How do I open several files in Vim, with each file in a separate<br>
&nbsp;&nbsp;&nbsp;&nbsp; window/tab?<br>
<br>
You can use the -o and -O Vim command line arguments to open multiple files<br>
in separate horizontally or vertically split Vim windows. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -o3 f1.txt f2.txt f3.txt</div>
<br>
The above command will open the files f1.txt, f2.txt and f3.txt in three<br>
separate horizontally split Vim windows.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -O3 f1.txt f2.txt f3.txt</div>
<br>
The above command will open the files f1.txt, f2.txt and f3.txt in three<br>
separate vertically split Vim windows.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -p f1.txt f2.txt f3.txt</div>
<br>
The above command will open the files f1.txt, f2.txt and f3.txt in three<br>
separate tab windows. The option&nbsp;<a class="Type" href="options.html#'tabpagemax'">'tabpagemax'</a>&nbsp;defines, how many tabpages<br>
can be opened at the same time, by default it is set to 10.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-o">-o</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-O">-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-p">-p</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#startup-options">startup-options</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'tabpagemax'">'tabpagemax'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.4" name="faq-6.4">faq-6.4</a><br>
6.4. How do I configure Vim to autoload several files at once similar to<br>
&nbsp;&nbsp;&nbsp;&nbsp; &quot;work-sets&quot; or &quot;projects&quot;?<br>
<br>
You can use the &quot;:mksession&quot; and the &quot;:mkview&quot; commands to autoload several<br>
files in Vim.<br>
<br>
The &quot;:mksession&quot; command creates a Vim script that restores the current<br>
editing session. You can use the &quot;:source&quot; command to source the file<br>
produced by the mksession command.<br>
<br>
The &quot;:mkview&quot; command creates a Vim script that restores the contents of<br>
the current window. You can use the &quot;:loadview&quot; command to load the view<br>
for the current file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_21.html#21.4">21.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_21.html#21.5">21.5</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#views-sessions">views-sessions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'sessionoptions'">'sessionoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:mksession">:mksession</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:source">:source</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#v:this_session">v:this_session</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:mkview">:mkview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:loadview">:loadview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viewdir'">'viewdir'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#buffers">buffers</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.5" name="faq-6.5">faq-6.5</a><br>
6.5. Is it possible to open multiple top level windows in a single instance<br>
&nbsp;&nbsp;&nbsp;&nbsp; of Vim similar to Nedit or Emacs?<br>
<br>
No. It is currently not possible to open multiple top-level windows in a<br>
single instance of Vim. This feature is in the todo list.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.6" name="faq-6.6">faq-6.6</a><br>
6.6. How do I browse/explore directories from within Vim?<br>
<br>
You can use the netrw.vim plugin, supplied with the standard Vim<br>
installation, to browse/explore directories from within Vim. You can start<br>
the file explorer using one of the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e &lt;directory&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:Explore<br>
&nbsp;&nbsp;&nbsp;&nbsp;:Sexplore<br>
&nbsp;&nbsp;&nbsp;&nbsp;:Vexplore<br>
&nbsp;&nbsp;&nbsp;&nbsp;:Texplore</div>
<br>
From the file explorer, you can browse through directories, rename, delete<br>
and edit files.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pi_netrw.html#netrw.vim">netrw.vim</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_22.html#22.1">22.1</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-6.7" name="faq-6.7">faq-6.7</a><br>
6.7. How do I edit files over a network using ftp/scp/rcp/http?<br>
<br>
You can use the netrw.vim plugin, supplied with the standard Vim package,<br>
to edit files over a network using ftp/scp/rcp/http. Using this plugin, Vim<br>
will transparently load and save the files over ftp/scp/rcp/http. For<br>
example, to edit a file over ftp, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim ftp://machine/path</div>
<br>
For more information, read:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pi_netrw.html#netrw.vim">netrw.vim</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-7" name="faq-7">faq-7</a><br>
SECTION 7 - BACKUP<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-7.1" name="faq-7.1">faq-7.1</a><br>
7.1. When I edit and save files, Vim creates a file with the same name as<br>
&nbsp;&nbsp;&nbsp;&nbsp; the original file and a &quot;~&quot; character at the end. How do I stop Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp; from creating this file? (or) How do I disable the Vim backup file<br>
&nbsp;&nbsp;&nbsp;&nbsp; feature?<br>
<br>
You have set the&nbsp;<a class="Type" href="options.html#'backup'">'backup'</a>&nbsp;option, so Vim creates a backup file when saving<br>
the original file. You can stop Vim from creating the backup file, by<br>
clearing the option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nobackup</div>
<br>
<span class="Todo">Note</span>&nbsp;that, by default this option is turned off. You have explicitly<br>
enabled the&nbsp;<a class="Type" href="options.html#'backup'">'backup'</a>&nbsp;option in one of the initialization files. You may<br>
also have to turn off the&nbsp;<a class="Type" href="options.html#'writebackup'">'writebackup'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nowritebackup</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.4">07.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#backup-table">backup-table</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backup'">'backup'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'writebackup'">'writebackup'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupskip'">'backupskip'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupdir'">'backupdir'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupext'">'backupext'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupcopy'">'backupcopy'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#backup">backup</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-7.2" name="faq-7.2">faq-7.2</a><br>
7.2. When I edit and save files, Vim creates a file with the same name as<br>
&nbsp;&nbsp;&nbsp;&nbsp; the original file and a &quot;un~&quot; extension at the end. How do I stop Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp; from creating this file (or) How do I disable the Vim undofile feature?<br>
<br>
Vim 7.3 contains as new feature persistent undo, that is, undo information<br>
<span class="PreProc">won't be lost when quitting Vim and be stored in a file that ends with .un</span><br>
You have set the&nbsp;<a class="Type" href="options.html#'undofile'">'undofile'</a>&nbsp;option, so Vim creates an undo file when saving<br>
the original file. You can stop Vim from creating the backup file, by<br>
clearing the option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set noundofile</div>
<br>
<span class="Todo">Note</span>&nbsp;that, by default this option is turned off. You have explicitly<br>
enabled the&nbsp;<a class="Type" href="options.html#'undofile'">'undofile'</a>&nbsp;option in one of the initialization files. If you<br>
want your undofiles to be stored only in a particular directory, you can<br>
point the&nbsp;<a class="Type" href="options.html#'undodir'">'undodir'</a>&nbsp;option to a directory that will contain all your<br>
aggregated undofiles.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'undodir'">'undodir'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'undofile'">'undofile'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="undo.html#undo-persistence">undo-persistence</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-7.3" name="faq-7.3">faq-7.3</a><br>
7.3. How do I configure Vim to store all the backup files in a particular<br>
&nbsp;&nbsp;&nbsp;&nbsp; directory?<br>
<br>
You can configure Vim to store all the backup files in a particular<br>
directory using the&nbsp;<a class="Type" href="options.html#'backupdir'">'backupdir'</a>&nbsp;option. For example, to store all the<br>
backup files in the ~/backup directory, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set backupdir=~/backup</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_07.html#07.4">07.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupdir'">'backupdir'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#backup">backup</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-7.4" name="faq-7.4">faq-7.4</a><br>
7.4. When I save a file with Vim, the file permissions are changed.<br>
&nbsp;&nbsp;&nbsp;&nbsp; How do I configure Vim to save a file without changing the file<br>
&nbsp;&nbsp;&nbsp;&nbsp; permissions?<br>
<br>
This may happen, if the&nbsp;<a class="Type" href="options.html#'backupcopy'">'backupcopy'</a>&nbsp;option is set to&nbsp;<span class="MissingTag">'no'</span>&nbsp;or&nbsp;<span class="MissingTag">'auto'</span>.&nbsp;<span class="Todo">Note</span><br>
that the default value for this option is set in such a way that this will<br>
correctly work in most of the cases. If the default doesn't work for you,<br>
try setting the&nbsp;<a class="Type" href="options.html#'backupcopy'">'backupcopy'</a>&nbsp;option to&nbsp;<span class="MissingTag">'yes'</span>&nbsp;to keep the file permission<br>
when saving a file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set backupcopy=yes</div>
<br>
This applies, only if you have configured Vim to make a backup whenever<br>
overwriting a file. By default, Vim will not backup files.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backupcopy'">'backupcopy'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#backup">backup</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backup'">'backup'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'writebackup'">'writebackup'</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8" name="faq-8">faq-8</a><br>
SECTION 8 - BUFFERS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.1" name="faq-8.1">faq-8.1</a><br>
8.1. I have made some modifications to a buffer. How do I edit another<br>
&nbsp;&nbsp;&nbsp;&nbsp; buffer without saving the modified buffer and also without losing the<br>
&nbsp;&nbsp;&nbsp;&nbsp; modifications?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'hidden'">'hidden'</a>&nbsp;option to edit a file without losing modifications<br>
to the current file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set hidden</div>
<br>
By setting the&nbsp;<a class="Type" href="options.html#'hidden'">'hidden'</a>&nbsp;option, you can also save the modification history<br>
(undo-history) for the buffer. Otherwise, as you switch between files, the<br>
undo-history will be lost (unless you use persistent undofiles).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'hidden'">'hidden'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#hidden-quit">hidden-quit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:hide">:hide</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.2" name="faq-8.2">faq-8.2</a><br>
8.2. How do I configure Vim to auto-save a modified buffer when switching<br>
&nbsp;&nbsp;&nbsp;&nbsp; to another buffer?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'autowrite'">'autowrite'</a>&nbsp;option to auto-save a modified buffer when<br>
switching to another buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set autowrite</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'autowrite'">'autowrite'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'autowriteall'">'autowriteall'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'hidden'">'hidden'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.3" name="faq-8.3">faq-8.3</a><br>
8.3. How do I replace the buffer in the current window with a blank buffer?<br>
<br>
You can use the &quot;:enew&quot; command to load an empty buffer in place of the<br>
buffer in the current window.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:enew">:enew</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.4" name="faq-8.4">faq-8.4</a><br>
8.4. Is there a keyboard shortcut to load a buffer by the buffer number?<br>
<br>
You can use the&nbsp;<span class="Special">CTRL-^</span>&nbsp;command to load a buffer by specifying the buffer<br>
number. For example, to load buffer number 5, you have to use the 5&nbsp;<span class="Special">CTRL-^</span><br>
command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#CTRL-^">CTRL-^</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.5" name="faq-8.5">faq-8.5</a><br>
8.5. How do I open all the current buffers in separate windows?<br>
<br>
You can use the &quot;:ball&quot; or &quot;:sball&quot; commands to open all the buffers<br>
in the buffer list:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:ball</div>
<br>
If you want all buffers to be opened in new tabs, simply prefix the :tab<br>
command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:tab :sball</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:ball">:ball</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.6" name="faq-8.6">faq-8.6</a><br>
8.6. How do I close (delete) a buffer without exiting Vim?<br>
<br>
You can use any of &quot;:bdelete&quot;, &quot;:bwipeout&quot; or &quot;:bunload&quot; commands to<br>
delete a buffer without exiting Vim. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:bdelete file1</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bdelete">:bdelete</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bwipeout">:bwipeout</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bunload">:bunload</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.7" name="faq-8.7">faq-8.7</a><br>
8.7. When I use the command &quot;:%bd&quot; to delete all the buffers, not all the<br>
&nbsp;&nbsp;&nbsp;&nbsp; buffers are deleted. Why?<br>
<br>
In the &quot;:%bd&quot; command, the '%' range will be replaced with the starting and<br>
ending line numbers in the current buffer. Instead of using '%' as the<br>
range, you should specify numbers for the range. For example, to delete all<br>
the buffers, you can use the command &quot;:1,9999bd&quot;.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bd">:bd</a><br>
<br>
(This behaviour has been fixed with patch 7.4.530)<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.8" name="faq-8.8">faq-8.8</a><br>
8.8. How do I display the buffer number of the current buffer/file?<br>
<br>
You can use 2<span class="Special">&lt;CTRL-G&gt;</span>&nbsp;command to display the buffer number for the current<br>
file/buffer.&nbsp;<span class="Todo">Note</span>&nbsp;the use of count before the&nbsp;<span class="Special">CTRL-G</span>&nbsp;command. If the count<br>
is greater than 1, then Vim will display the buffer number.<br>
<br>
You can also use the following command to display the current buffer<br>
number:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo bufnr(&quot;%&quot;)</div>
<br>
You can also include the &quot;%n&quot; field to the&nbsp;<a class="Type" href="options.html#'statusline'">'statusline'</a>&nbsp;option to display<br>
the current buffer number on the statusline.<br>
<br>
For more information read,&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#CTRL-G">CTRL-G</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#bufnr()">bufnr()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:echo">:echo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'statusline'">'statusline'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.9" name="faq-8.9">faq-8.9</a><br>
8.9. How do I delete a buffer without closing the window in which the<br>
&nbsp;&nbsp;&nbsp;&nbsp; buffer is displayed?<br>
<br>
You can use the following command to open the next buffer and delete<br>
the current buffer.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:bnext | bdelete #</div>
<br>
For more information read,&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bnext">:bnext</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bdelete">:bdelete</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:buffers">:buffers</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-8.10" name="faq-8.10">faq-8.10</a><br>
8.10. How do I map the tab key to cycle through and open all the buffers?<br>
<br>
You can use the following two map commands, to map the&nbsp;<span class="Special">CTRL-T</span>ab key to open<br>
the next buffer and the&nbsp;<span class="Special">CTRL-S</span>HIFT-Tab key to open the previous buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;C-Tab&gt; :bnext&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;S-C-Tab&gt; :bprevious&lt;CR&gt;</div>
<br>
<span class="Todo">Note</span>, this might not work in the terminal version of Vim.<br>
<br>
For more information read,&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bnext">:bnext</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bprevious">:bprevious</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-9" name="faq-9">faq-9</a><br>
SECTION 9 - WINDOWS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-9.1" name="faq-9.1">faq-9.1</a><br>
9.1. What is the difference between a Vim window and a buffer?<br>
<br>
A Vim buffer is a file loaded into memory for editing. The original file<br>
remains unchanged until you write the buffer to the file. A Vim window is a<br>
viewport onto a buffer. You can use multiple windows on one buffer or<br>
several windows on different buffers.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_08.html">usr_08.txt</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_22.html#22.4">22.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#windows-intro">windows-intro</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickref.html#Q_wi">Q_wi</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-9.2" name="faq-9.2">faq-9.2</a><br>
9.2. How do I increase the width of a Vim window?<br>
<br>
You can increase the width of a Vim window using one of the following<br>
commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vert resize +N<br>
&nbsp;&nbsp;&nbsp;&nbsp;:vert resize -N<br>
&nbsp;&nbsp;&nbsp;&nbsp;:vert resize N</div>
<br>
You can also use&nbsp;<span class="Special">CTRL-W</span>&nbsp;&lt; or&nbsp;<span class="Special">CTRL-W</span>&nbsp;&gt; or&nbsp;<span class="Special">CTRL-W</span>&nbsp;| commands.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:vertical-resize">:vertical-resize</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#CTRL-W_>">CTRL-W_&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#CTRL-W_<">CTRL-W_&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#window-resize">window-resize</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-9.3" name="faq-9.3">faq-9.3</a><br>
9.3. How do I zoom into or out of a window?<br>
<br>
You can zoom into a window (close all the windows except the current<br>
window) using the &quot;<span class="Special">CTRL-W</span>&nbsp;o&quot; command or the &quot;:only&quot; ex command.<br>
<br>
You can use the &quot;<span class="Special">CTRL-W</span>&nbsp;_&quot; command or the &quot;:resize&quot; ex command to increase<br>
the current window height to the highest possible without closing other<br>
windows.<br>
<br>
You can use the &quot;<span class="Special">CTRL-W</span>&nbsp;|&quot; command or the &quot;:vertical resize&quot; ex command to<br>
increase the current window width to the highest possible without closing<br>
other windows.<br>
<br>
You can use the &quot;<span class="Special">CTRL-W</span>&nbsp;=&quot; command to make the height and width of all the<br>
windows equal.<br>
<br>
You can also set the following options to get better results with the above<br>
commands:<br>
<br>
Method 1:<br>
Set the&nbsp;<a class="Type" href="options.html#'winminheight'">'winminheight'</a>&nbsp;option to 0:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set winminheight=0</div>
<br>
By default, this option is set to 1.<br>
This option controls the minimum height of an inactive window (when it is<br>
not the current window).&nbsp;&nbsp;When the&nbsp;<a class="Type" href="options.html#'winminheight'">'winminheight'</a>&nbsp;option is set to 0, only<br>
the status line will be displayed for inactive windows.<br>
<br>
Method 2:<br>
Set the&nbsp;<a class="Type" href="options.html#'noequalalways'">'noequalalways'</a>&nbsp;option and set the&nbsp;<a class="Type" href="options.html#'winheight'">'winheight'</a>&nbsp;option to a large<br>
value (like 99999):<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set noequalalways<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set winheight=99999</div>
<br>
Now, the active window will always open to its maximum size, while the<br>
other windows will stay present, but shrunken to just a status line.<br>
<br>
With any of the above mentioned methods, you cannot restore the window<br>
layout after zooming into a window.&nbsp;&nbsp;If you want to restore the Vim window<br>
layout after zooming into a window, you can use the ZoomWin plugin. You can<br>
download this plugin from the Vim online website at:<br>
<br>
<span class="Constant"><a href="http://vim.sourceforge.net/scripts/script.php?script_id=508">http://vim.sourceforge.net/scripts/script.php?script_id=508</a></span><br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#CTRL-W_o">CTRL-W_o</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#window-resize">window-resize</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'winminheight'">'winminheight'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'equalalways'">'equalalways'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'winheight'">'winheight'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_08.html#08.3">08.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-9.4" name="faq-9.4">faq-9.4</a><br>
9.4. How do I execute an ex command on all the open buffers or open windows<br>
&nbsp;&nbsp;&nbsp;&nbsp; or all the files in the argument list?<br>
<br>
You can use the &quot;:bufdo&quot; command to execute an ex command on all the open<br>
buffers.&nbsp;&nbsp;You can use the &quot;:windo&quot; command to execute an ex command on all<br>
the open windows.&nbsp;&nbsp;You can use the &quot;:argdo&quot; command to execute an ex<br>
command on all the files specified in the argument list. And finally you<br>
can use the &quot;:tabdo&quot; command to execute an ex command in all open tab pages.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:windo">:windo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bufdo">:bufdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:argdo">:argdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tabpage.html#:tabdo">:tabdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_26.html#26.3">26.3</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10" name="faq-10">faq-10</a><br>
SECTION 10 - MOTION<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.1" name="faq-10.1">faq-10.1</a><br>
10.1. How do I jump to the beginning (first line) or end (last line) of a<br>
&nbsp;&nbsp;&nbsp;&nbsp; file?<br>
<br>
You can use 'G' command to jump to the last line in the file and the&nbsp;<span class="MissingTag">'gg'</span><br>
command to jump to the first line in the file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#G">G</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gg">gg</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.2" name="faq-10.2">faq-10.2</a><br>
10.2. In insert mode, when I press the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key to go to command mode, the<br>
&nbsp;&nbsp;&nbsp;&nbsp; cursor moves one character to the left (except when the cursor is on<br>
&nbsp;&nbsp;&nbsp;&nbsp; the first character of the line). Is it possible to change this<br>
&nbsp;&nbsp;&nbsp;&nbsp; behavior to keep the cursor at the same column?<br>
<br>
No. It is not possible to change this behavior. The cursor is always<br>
positioned on a valid character (unless you have virtual-edit mode<br>
enabled). So, if you are appending text to the end of a line, when you<br>
return to command mode the cursor&nbsp;<a class="Constant" href="vim_faq.html#must" name="must">must</a>&nbsp;drop back onto the last character<br>
you typed. For consistency sake, the cursor drops back everywhere, even if<br>
you are in the middle of a line.<br>
<br>
You can use the&nbsp;<span class="Special">CTRL-O</span>&nbsp;or&nbsp;<span class="Special">CTRL-\</span>&nbsp;<span class="Special">CTRL-O</span>&nbsp;command in insert mode to execute a<br>
single ex command and return back to insert mode without moving the cursor<br>
column.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'virtualedit'">'virtualedit'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-\_CTRL-O">i_CTRL-\_CTRL-O</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.3" name="faq-10.3">faq-10.3</a><br>
10.3. How do I configure Vim to maintain the horizontal cursor position when<br>
&nbsp;&nbsp;&nbsp;&nbsp; scrolling with the &lt;Page Up&gt;, &lt;Page Down&gt;, etc keys?<br>
<br>
You can reset the&nbsp;<a class="Type" href="options.html#'startofline'">'startofline'</a>&nbsp;option to keep the cursor at the same<br>
horizontal location when scrolling text:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nostartofline</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'startofline'">'startofline'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.4" name="faq-10.4">faq-10.4</a><br>
10.4. Some lines in a file are more than the screen width and they are all<br>
&nbsp;&nbsp;&nbsp;&nbsp; wrapped. When I use the j, k keys to move from one line to the next,<br>
&nbsp;&nbsp;&nbsp;&nbsp; the cursor is moved to the next line in the file instead of the next<br>
&nbsp;&nbsp;&nbsp;&nbsp; line on the screen. How do I move from one screen line to the next?<br>
<br>
You can use the gj and gk commands to move from one screen line to the<br>
next/previous screen line. The j and k commands move the cursor from one<br>
file line to the next file line. You can also avoid the line wrapping by<br>
resetting the&nbsp;<a class="Type" href="options.html#'wrap'">'wrap'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nowrap</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gj">gj</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gk">gk</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'wrap'">'wrap'</a><br>
<br>
You can use the following mappings:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;Up&gt; gk<br>
&nbsp;&nbsp;&nbsp;&nbsp;:imap &lt;Up&gt; &lt;C-o&gt;gk<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;Down&gt; gj<br>
&nbsp;&nbsp;&nbsp;&nbsp;:imap &lt;Down&gt; &lt;C-o&gt;gj<br>
&nbsp;&nbsp;&nbsp;&nbsp;:noremap j gj<br>
&nbsp;&nbsp;&nbsp;&nbsp;:noremap k gk</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.5" name="faq-10.5">faq-10.5</a><br>
10.5. What is the definition of a sentence, paragraph and section in Vim?<br>
<br>
A sentence is defined as ending at a '.', '!' or '?' followed by either the<br>
end of a line, or by a space (or two) or tab. Which characters and the<br>
number of spaces needed to constitute a sentence ending is determined by<br>
the&nbsp;<a class="Type" href="options.html#'joinspaces'">'joinspaces'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>&nbsp;options.<br>
<br>
A paragraph begins after each empty line, and also at each of a set of<br>
paragraph macros, specified by the pairs of characters in the&nbsp;<a class="Type" href="options.html#'paragraphs'">'paragraphs'</a><br>
option.<br>
<br>
A section begins after a form-feed (<span class="Special">&lt;C-L&gt;</span>) in the first column and at each<br>
of a set of section macros, specified by the pairs of characters in the<br>
<a class="Type" href="options.html#'sections'">'sections'</a>&nbsp;option.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#sentence">sentence</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'joinspaces'">'joinspaces'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cpoptions'">'cpoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#paragraph">paragraph</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#section">section</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#word">word</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.6" name="faq-10.6">faq-10.6</a><br>
10.6. How do I jump to beginning or end of a sentence, paragraph or a<br>
&nbsp;&nbsp;&nbsp;&nbsp; section?<br>
<br>
You can use the following motion commands to jump to the beginning or end<br>
of a sentence or a paragraph or a section:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;motion&nbsp;&nbsp;position&nbsp;&nbsp;&nbsp;&nbsp;where<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; beginning&nbsp;&nbsp; current sentence<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current sentence<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; beginning&nbsp;&nbsp; current paragraph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current paragraph<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; previous section<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beginning&nbsp;&nbsp; current section<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;][&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; current section<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beginning&nbsp;&nbsp; next section</div>
<br>
Each of these motions can be preceded by a number which will extend the<br>
jump forward (or backward).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#object-motions">object-motions</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.7" name="faq-10.7">faq-10.7</a><br>
10.7. I have lines in a file that extends beyond the right extent of the<br>
&nbsp;&nbsp;&nbsp;&nbsp; screen. How do I move the Vim view to the right to see the text off<br>
&nbsp;&nbsp;&nbsp;&nbsp; the screen?<br>
<br>
You can use one of the following commands to horizontally scroll the screen<br>
to the left or right:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;zl - scroll to the left<br>
&nbsp;&nbsp;&nbsp;&nbsp;zh - scroll to the right<br>
&nbsp;&nbsp;&nbsp;&nbsp;zL - scroll half a screenwidth to the left<br>
&nbsp;&nbsp;&nbsp;&nbsp;zH - scroll half a screenwidth to the right<br>
&nbsp;&nbsp;&nbsp;&nbsp;zs - scroll to position the cursor at the start of the screen<br>
&nbsp;&nbsp;&nbsp;&nbsp;ze - scroll to position the cursor at the end of the screen</div>
<br>
You can use the g0 command to move the cursor to the first character of the<br>
screen line and the g$ command to move the cursor to the last character of<br>
the screen line without scrolling the screen.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="scroll.html#scroll-horizontal">scroll-horizontal</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.8" name="faq-10.8">faq-10.8</a><br>
10.8. How do I scroll two or more buffers simultaneously?<br>
<br>
You can set the &quot;scrollbind&quot; option for each of the buffers to scroll them<br>
simultaneously.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'scrollbind'">'scrollbind'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="scroll.html#scroll-binding">scroll-binding</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'scrollopt'">'scrollopt'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cursorbind'">'cursorbind'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.9" name="faq-10.9">faq-10.9</a><br>
10.9. When I use my arrow keys, Vim changes modes, inserts weird characters<br>
&nbsp;&nbsp;&nbsp;&nbsp; in my document but doesn't move the cursor properly. What's going on?<br>
<br>
There are a couple of things that could be going on: either you are using<br>
Vim over a slow connection or Vim doesn't understand the key sequence that<br>
your keyboard is generating.<br>
<br>
If you are working over a slow connection (such as a 2400 bps modem), you<br>
can try to set the&nbsp;<a class="Type" href="options.html#'timeout'">'timeout'</a>&nbsp;or&nbsp;<a class="Type" href="options.html#'ttimeout'">'ttimeout'</a>&nbsp;option. These options, combined<br>
with the&nbsp;<a class="Type" href="options.html#'timeoutlen'">'timeoutlen'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'ttimeoutlen'">'ttimeoutlen'</a>&nbsp;options, may fix the problem.<br>
<br>
The preceding procedure will not work correctly if your terminal sends key<br>
codes that Vim does not understand. In this situation, your best option is<br>
to map your key sequence to a matching cursor movement command and save<br>
these mappings in a file. You can then &quot;:source&quot; the file whenever you work<br>
from that terminal.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'timeout'">'timeout'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ttimeout'">'ttimeout'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'timeoutlen'">'timeoutlen'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ttimeoutlen'">'ttimeoutlen'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map">:map</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#vt100-cursor-keys">vt100-cursor-keys</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.10" name="faq-10.10">faq-10.10</a><br>
10.10. How do I configure Vim to move the cursor to the end of the previous<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line, when the left arrow key is pressed and the cursor is currently<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;at the beginning of a line?<br>
<br>
You can add the '&lt;' flag to the&nbsp;<a class="Type" href="options.html#'whichwrap'">'whichwrap'</a>&nbsp;option to configure Vim to move<br>
the cursor to the end of the previous line, when the left arrow key is<br>
pressed and the cursor is currently at the beginning of a line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set whichwrap+=&lt;</div>
<br>
Similarly, to move the cursor the beginning of the next line, when the<br>
right arrow key is&nbsp;&nbsp;pressed and the cursor is currently at the end of a<br>
line, add the '&gt;' flag to the&nbsp;<a class="Type" href="options.html#'whichwrap'">'whichwrap'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set whichwrap+=&gt;</div>
<br>
The above will work only in normal and visual modes. To use this in insert<br>
and replace modes, add the '[' and ']' flags respectively.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'whichwrap'">'whichwrap'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#05.7">05.7</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.11" name="faq-10.11">faq-10.11</a><br>
10.11. How do I configure Vim to stay only in insert mode (modeless<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;editing)?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'insertmode'">'insertmode'</a>&nbsp;option to configure Vim to stay only in insert<br>
mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set insertmode</div>
<br>
By setting this option, you can use Vim as a modeless editor. If you press<br>
the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key, Vim will not go to the normal mode. To execute a single<br>
normal mode command, you can press&nbsp;<span class="Special">CTRL-O</span>&nbsp;followed by the normal mode<br>
command.&nbsp;&nbsp;To execute more than one normal command, you can use&nbsp;<span class="Special">CTRL-L</span><br>
followed by the commands. To return to insert mode, press the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key. To<br>
disable this option, reset the&nbsp;<a class="Type" href="options.html#'insertmode'">'insertmode'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set noinsertmode</div>
<br>
You can also start vim using the &quot;evim&quot; command or you can use &quot;vim -y&quot; to<br>
use Vim as a modeless editor.<br>
<br>
You can also start Vim in insert mode using the &quot;:startinsert&quot; ex command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'insertmode'">'insertmode'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#:startinsert">:startinsert</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#:stopinsert">:stopinsert</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-L">i_CTRL-L</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#evim">evim</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#evim-keys">evim-keys</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.12" name="faq-10.12">faq-10.12</a><br>
10.12. How do I display some context lines when scrolling text?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'scrolloff'">'scrolloff'</a>&nbsp;option to display a minimal number of screen<br>
lines (context) above and below the cursor.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set scrolloff=10</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'scrolloff'">'scrolloff'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'sidescrolloff'">'sidescrolloff'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-10.13" name="faq-10.13">faq-10.13</a><br>
10.13. How do I go back to previous cursor locations?<br>
<br>
You can go back to the cursor location before the latest jump using the ''<br>
or `` command. You can use the&nbsp;<span class="Special">CTRL-O</span>&nbsp;command to go back to older cursor<br>
positions and the&nbsp;<span class="Special">CTRL-I</span>&nbsp;command to go to the newer cursor positions in the<br>
jump list.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_03.html#03.10">03.10</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#mark-motions">mark-motions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#jump-motions">jump-motions</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11" name="faq-11">faq-11</a><br>
SECTION 11 - SEARCHING TEXT<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.1" name="faq-11.1">faq-11.1</a><br>
11.1. After I searched for a text with a pattern, all the matched text<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stays highlighted. How do I turn off the highlighting<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;temporarily/permanently?<br>
<br>
The&nbsp;<a class="Type" href="options.html#'hlsearch'">'hlsearch'</a>&nbsp;option controls whether all the matches for the last<br>
searched pattern are highlighted or not. By default, this option is not<br>
enabled. If this option is set in a system-wide vimrc file, then you can<br>
turn off the search highlighting by using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nohlsearch</div>
<br>
To temporarily turn off the search highlighting, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nohlsearch</div>
<br>
You can also clear the search highlighting, by searching for a pattern that<br>
is not in the current file (for example, search for the pattern&nbsp;<span class="MissingTag">'asdf'</span>).<br>
<br>
You can use this mapping, to clear the search highlighting when<br>
redrawing the window pressing&nbsp;<span class="Special">&lt;CTRL-L&gt;</span><br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; &lt;C-L&gt; &lt;C-L&gt;:nohls&lt;CR&gt;</div>
<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'hlsearch'">'hlsearch'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#:nohlsearch">:nohlsearch</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.2" name="faq-11.2">faq-11.2</a><br>
11.2. How do I enter a carriage return character in a search pattern?<br>
<br>
You can either use '\r' or&nbsp;<span class="Special">&lt;CTRL-V&gt;&lt;CTRL-M&gt;</span>&nbsp;to enter a carriage return<br>
character in a pattern. In Vim scripts, it is better to use '\r' for the<br>
carriage return character.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.3" name="faq-11.3">faq-11.3</a><br>
11.3. How do I search for the character ^M?<br>
<br>
You can enter the ^M character in a search command by first pressing the<br>
<span class="Special">CTRL-V</span>&nbsp;key and then pressing the&nbsp;<span class="Special">CTRL-M</span>&nbsp;key.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^V^M</div>
<br>
You can also use the &quot;\r&quot; character. In Vim scripts, &quot;\r&quot; is preferred.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_CTRL-V">c_CTRL-V</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#using_CTRL-V">using_CTRL-V</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\r">/\r</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.4" name="faq-11.4">faq-11.4</a><br>
11.4. How can I search/replace characters that display as '~R', '~S', etc.?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'ga'</span>&nbsp;command to display the ASCII value/code for the<br>
special character. For example, let us say the ASCII value is 142. Then you<br>
can use the following command to search for the special character:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^V142</div>
<br>
where, ^V is entered by pressing&nbsp;<span class="Special">CTRL-V</span>.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#ga">ga</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="MissingTag">using_CTRL_V</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_24.html#24.8">24.8</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.5" name="faq-11.5">faq-11.5</a><br>
11.5. How do I highlight all the non-printable characters in a file?<br>
<br>
You can use the following commands and search pattern to highlight all the<br>
non-printable characters in a file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set hlsearch<br>
&nbsp;&nbsp;&nbsp;&nbsp;/\(\p\|$\)\@!.</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\p">/\p</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/bar">/bar</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/$">/$</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\(">/\(</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\@!">/\@!</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'hlsearch'">'hlsearch'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.6" name="faq-11.6">faq-11.6</a><br>
11.6. How do I search for whole words in a file?<br>
<br>
You can search for whole words in a file using the \&lt; and \&gt; atoms. For<br>
example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/\&lt;myword\&gt;</div>
<br>
The \&lt; atom matches the beginning of the word and the \&gt; atom matches the<br>
end of the word.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\<">/\&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\>">/\&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.7" name="faq-11.7">faq-11.7</a><br>
11.7. How do I search for the current word under the cursor?<br>
<br>
You can press the * key to search forward for the current word under the<br>
cursor.&nbsp;&nbsp;To search backward, you can press the # key.&nbsp;<span class="Todo">Note</span>&nbsp;that only whole<br>
keywords will be searched using these commands.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#star">star</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html##">#</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#gstar">gstar</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#g#">g#</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_03.html#03.8">03.8</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#search-commands">search-commands</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.8" name="faq-11.8">faq-11.8</a><br>
11.8. How do I search for a word without regard to the case (uppercase or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lowercase)?<br>
<br>
To always ignore case while searching for a pattern, set the&nbsp;<a class="Type" href="options.html#'ignorecase'">'ignorecase'</a><br>
option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set ignorecase</div>
<br>
To ignore case only when searching a particular pattern, use the special \c<br>
directive:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/\c&lt;pattern&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ignorecase'">'ignorecase'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/ignorecase">/ignorecase</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\c">/\c</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.9" name="faq-11.9">faq-11.9</a><br>
11.9. How do I search for words that occur twice consecutively?<br>
<br>
You can use one of the following search commands to locate words that occur<br>
twice consecutively:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp; /\(\&lt;\w\+\)\_s\+\1\&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp; /\(\&lt;\k\+\)\_s\+\1\&gt;</div>
<br>
The main difference is the use of '\w' and '\k', where the latter is based<br>
on the&nbsp;<a class="Type" href="options.html#'iskeyword'">'iskeyword'</a>&nbsp;option which may include accented and other language<br>
specific characters.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\1">/\1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\(">/\(</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\)">/\)</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\<">/\&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\>">/\&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\w">/\w</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\k">/\k</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\+">/\+</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\_x">/\_x</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'iskeyword'">'iskeyword'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.10" name="faq-11.10">faq-11.10</a><br>
11.10. How do I count the number of times a particular word occurs in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer?<br>
<br>
You can use the following set of commands to count the number of times a<br>
particular word occurs in a buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let cnt=0<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/\&lt;your_word\&gt;/let cnt=cnt+1<br>
&nbsp;&nbsp;&nbsp;&nbsp;:echo cnt</div>
<br>
This only counts the number of lines where the word occurs. You can also<br>
use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/\&lt;word\&gt;/&amp;/gn</div>
<br>
To count the number of alphabetic words in a file, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/\a\+/&amp;/gn</div>
<br>
To count the number of words made up of non-space characters, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/\S\+/&amp;/gn</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#count-items">count-items</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#word-count">word-count</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#v_g_CTRL-G">v_g_CTRL-G</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_12.html#12.5">12.5</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s_flags">:s_flags</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.11" name="faq-11.11">faq-11.11</a><br>
11.11. How do I place the cursor at the end of the matched word when<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; searching for a pattern?<br>
<br>
You can use the 'e' offset to the search command to place the cursor at the<br>
end of the matched word. For example<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/mypattern/e</div>
<br>
For more information about search offsets, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#search-offset">search-offset</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/">/</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.12" name="faq-11.12">faq-11.12</a><br>
11.12. How do I search for an empty line?<br>
<br>
You can search for an empty line using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^$</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;or<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^\s*$</div>
<br>
The latter also matches lines, that consist only of white space, while the<br>
former only matches true empty lines. For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/^">/^</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/$">/$</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\s">/\s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/star">/star</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#search-commands">search-commands</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.13" name="faq-11.13">faq-11.13</a><br>
11.13. How do I search for a line containing only a single character?<br>
<br>
You can search for a line containing only a single character using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^\s*\a\s*$</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/^">/^</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\a">/\a</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\s">/\s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/star">/star</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/$">/$</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.14" name="faq-11.14">faq-11.14</a><br>
11.14. How do I search and replace a string in multiple files?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'argdo'</span>,&nbsp;<span class="MissingTag">'bufdo'</span>,&nbsp;<span class="MissingTag">'windo'</span>&nbsp;or&nbsp;<span class="MissingTag">'tabdo'</span>&nbsp;commands to execute an<br>
ex command on multiple files. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:argdo %s/foo/bar/g|upd</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:argdo">:argdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:bufdo">:bufdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:windo">:windo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tabpage.html#:tabdo">:tabdo</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.15" name="faq-11.15">faq-11.15</a><br>
11.15. I am using the &quot;:s&quot; substitute command in a mapping. When a search<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for a pattern fails, the map terminates. I would like the map to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; continue processing the next command, even if the substitute command<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fails. How do I do this?<br>
<br>
You can use the 'e' flag to the substitute command to continue processing<br>
other commands in a map, when a pattern is not found.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s_flags">:s_flags</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.16" name="faq-11.16">faq-11.16</a><br>
11.16. How do I search for the n-th occurrence of a character in a line?<br>
<br>
To search for the n-th occurrence of a character in a line, you can prefix<br>
the 'f' command with a number. For example, to search for the 5th<br>
occurrence of the character @ in a line, you can use the command 5f@. This<br>
assumes the cursor is at the beginning of the line - and that this first<br>
character is not the one your are looking for.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#f">f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#F">F</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#t">t</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#T">T</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#;">;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#,">,</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.17" name="faq-11.17">faq-11.17</a><br>
11.17. How do I replace a tab (or any other character) with a hard return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (newline) character?<br>
<br>
You can replace a tab (or any other character) with a hard return (newline)<br>
character using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:s/\t/\r/</div>
<br>
<span class="Todo">Note</span>&nbsp;that in the above command, if you use \n instead of \r, then the tab<br>
characters will not be replaced by a new-line character.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#NL-used-for-Nul">NL-used-for-Nul</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#CR-used-for-NL">CR-used-for-NL</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.18" name="faq-11.18">faq-11.18</a><br>
11.18. How do I search for a character by its ASCII value?<br>
<br>
You can search for a character by its ASCII value by pressing&nbsp;<span class="Special">CTRL-V</span><br>
followed by the decimal or hexadecimal or octal value of that character in<br>
the search &quot;/&quot; command.&nbsp;&nbsp;To determine the ASCII value of a character you<br>
can use the &quot;:ascii&quot; or the &quot;ga&quot; command.<br>
<br>
For example, to search for the ASCII character with value 188 (??), you can<br>
use one of the following search commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/&lt;CTRL-V&gt;188<br>
&nbsp;&nbsp;&nbsp;&nbsp;/&lt;CTRL-V&gt;o274<br>
&nbsp;&nbsp;&nbsp;&nbsp;/&lt;CTRL-V&gt;xBC<br>
&nbsp;&nbsp;&nbsp;&nbsp;/&lt;CTRL-V&gt;u00bc</div>
<br>
You can also search for the character with the decimal/octal/hex number<br>
using a collation [] like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/[\d188]<br>
&nbsp;&nbsp;&nbsp;&nbsp;/[\o274]<br>
&nbsp;&nbsp;&nbsp;&nbsp;/[\xbc]<br>
&nbsp;&nbsp;&nbsp;&nbsp;/[\u00bc]</div>
<br>
Alternatively, you can use the special atom \%d \%o \%x \%u:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/\%d188<br>
&nbsp;&nbsp;&nbsp;&nbsp;/\%o274<br>
&nbsp;&nbsp;&nbsp;&nbsp;/\%xbc<br>
&nbsp;&nbsp;&nbsp;&nbsp;/\%u00bc</div>
<br>
Or you use digraphs to enter the character. For example enter:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/CTRL-K14</div>
<br>
to search for the above character.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-V_digit">i_CTRL-V_digit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:ascii">:ascii</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#ga">ga</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\]">/\]</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%d">/\%d</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#digraphs">digraphs</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.19" name="faq-11.19">faq-11.19</a><br>
11.19. How do I search for long lines?<br>
<br>
You can search for long lines or lines containing more than a specific<br>
number of characters using the Vim regular-expressions in the search<br>
command. For example, to search for all the lines containing more than 80<br>
characters, you can use one of the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/^.\{80}.\+$<br>
&nbsp;&nbsp;&nbsp;&nbsp;/^.*\%&gt;80c.*$<br>
&nbsp;&nbsp;&nbsp;&nbsp;/^.*\%&gt;80v.*$</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\{">/\{</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%c">/\%c</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%v">/\%v</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.20" name="faq-11.20">faq-11.20</a><br>
11.20. How do I display all the lines in the current buffer that contain a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; specified pattern?<br>
<br>
You can use the following command to display all the lines in the current<br>
buffer that contain a specified pattern:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/&lt;pattern&gt;/p</div>
<br>
For example, the following command will display all the lines in the<br>
current buffer that contain &quot;vim&quot;:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/vim/p</div>
<br>
Since :p is the default command to be executed for the ex command :g, you<br>
can also use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/vim</div>
<br>
If you also want the corresponding line numbers, then you can use the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/&lt;pattern&gt;/#</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:global">:global</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:print">:print</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:number">:number</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.21" name="faq-11.21">faq-11.21</a><br>
11.21. How do I search for a text string that spans multiple lines?<br>
<br>
You can search for a text string that spans multiple lines using the \_x<br>
regular expression atom. For example, to search for the text string &quot;Hello<br>
World&quot;, you can use the following search command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/Hello\_sWorld</div>
<br>
This will match the word &quot;Hello&quot; followed by a newline character and then<br>
the word &quot;World&quot; at the beginning of the next line. This will also match<br>
the word &quot;Hello&quot; immediately followed by a space character and then the<br>
word &quot;World&quot;. When searching for the &quot;Hello World&quot; string, to include the<br>
space characters at the end and beginning of the line, you can use the<br>
following search command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/Hello\_s\+World</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_27.html#27.8">27.8</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#pattern-atoms">pattern-atoms</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\_">/\_</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#pattern-searches">pattern-searches</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.22" name="faq-11.22">faq-11.22</a><br>
11.22. How do I search for a pattern within the specified range of lines<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; in a buffer?<br>
<br>
You can search for a pattern within a range of lines using the \%&gt;l<br>
and \%&lt;l regular expression atoms.<br>
<br>
For example, to search for the word&nbsp;<span class="MissingTag">'white'</span>&nbsp;between the lines 10 and 30 in<br>
a buffer, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/white\%&gt;9l\%&lt;31l</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%l">/\%l</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.23" name="faq-11.23">faq-11.23</a><br>
11.23. How do I clear the last searched pattern?<br>
<br>
The last searched pattern is stored in the &quot;/&quot; register. You can clear<br>
this register using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let @/=&quot;&quot;</div>
<br>
To clear the last search pattern whenever a buffer is unloaded, you can use<br>
the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd BufUnload * let @/ = &quot;&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#@/">@/</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-@">:let-@</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#autocmd-searchpat">autocmd-searchpat</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#last-pattern">last-pattern</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.24" name="faq-11.24">faq-11.24</a><br>
11.24. Why does this pattern 'a.\<span class="Special">{-}</span>p\@!' not match?<br>
<br>
&quot;\<span class="Special">{-}</span>&quot; doesn't just mean &quot;as few as possible&quot;, it means &quot;as few as<br>
possible to make the whole pattern succeed&quot;. If it didn't match the 'p',<br>
the whole pattern would fail (because of the &quot;p\@!&quot;) so it does match<br>
the &quot;p&quot;. It is a longer match, but it is the shortest match that makes<br>
the whole pattern succeed.&nbsp;<br>
<br>
If you wanted &quot;as few as possible regardless&quot; you would use &quot;\@&gt;&quot;, which<br>
basically divides a pattern up so that the pieces either side behave<br>
independently. If the pattern were &quot;a.\<span class="Special">{-}</span>\@&gt;p\@!&quot; then &quot;.\<span class="Special">{-}</span>&quot; would<br>
always match nothing because that's the smallest match that can succeed<br>
when there are not other restrictions. The whole pattern then would<br>
behave the same as &quot;ap\@!&quot;, i.e. it would match any &quot;a&quot; not followed by<br>
a &quot;p&quot;).<br>
<br>
This means, it matches as few as possible 'a's without trying to keep<br>
going until Vim finds the longest match. This means, it will still match<br>
<a class="Type" href="vi_diff.html#'ap'">'ap'</a>.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.25" name="faq-11.25">faq-11.25</a><br>
11.25. How can I use '/' within a pattern, without escaping it?<br>
<br>
When using / to search for a pattern, you need to escape all '/' within<br>
the pattern, because they would otherwise terminate the pattern. So you<br>
can't directly search for /usr/share/doc/ but need to search for<br>
\/usr\/share\/doc\/<br>
<br>
The easiest solution around that, would be to use '?' to start a<br>
backward search and afterwards use /<span class="Special">&lt;CR&gt;</span>&nbsp;to use the last search-pattern<br>
in forward direction.<br>
<br>
If you have a Vim, that has the eval-feature built in (which needs at<br>
least a normal built or higher), you can also directly paste the pattern<br>
into the search register:<br>
<br>
:let @/ = '/usr/share/doc/'<br>
<br>
Then use 'n' to jump to the next occurrence.<br>
<br>
See also the help at&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#@/">@/</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/<CR>">/&lt;CR&gt;</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-11.26" name="faq-11.26">faq-11.26</a><br>
11.26. How can I operate on a search match?<br>
<br>
The&nbsp;<span class="MissingTag">'gn'</span>&nbsp;command makes it easy to operate on regions of text that match<br>
the current search pattern. By default, it will search forward for the<br>
last used search pattern and visually select the match. If the cursor is<br>
already on the match, it will be visually selected. If you used the&nbsp;<span class="MissingTag">'gn'</span><br>
command after an operator (e.g. 'c' to change text), it will be applied<br>
on the match.<br>
<br>
If Visual mode is active before using gn, the visual selection will be<br>
extended until the end of the next match.&nbsp;<br>
<br>
The 'gN' commands works similar but searches backwards.<br>
<br>
This allows to repeat simple operations on each match. For example, you<br>
might want to change each occurence of apples by peaches. So you search<br>
using '/apple' then you can use 'cgnpeach<span class="Special">&lt;esc&gt;</span>' to replace the current<br>
match by peach. Now you can use the dot '.' command to redo the<br>
replacement for the rest of the buffer.<br>
<br>
See also the help at&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#gn">gn</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#gN">gN</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12" name="faq-12">faq-12</a><br>
SECTION 12 - CHANGING TEXT<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.1" name="faq-12.1">faq-12.1</a><br>
12.1. How do I delete all the trailing white space characters (SPACE and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TAB) at the end of all the lines in a file?<br>
<br>
You can use the &quot;:substitute&quot; command on the entire file to search and<br>
remove all the trailing white space characters:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/\s\+$//</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:%">:%</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s">:s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\s">/\s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\+">/\+</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/$">/$</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.2" name="faq-12.2">faq-12.2</a><br>
12.2. How do I replace all the occurrences of multiple consecutive space<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;characters to a single space?<br>
<br>
You can use the following command to replace all the occurrences of<br>
multiple consecutive space characters to a single space:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/ \{2,}/ /g</div>
<br>
Alternatively use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/&nbsp;&nbsp;\+/ /g</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:%">:%</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s">:s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\{">/\{</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s_flags">:s_flags</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.3" name="faq-12.3">faq-12.3</a><br>
12.3. How do I reduce a range of empty lines into one line only?<br>
<br>
You can use the following command to reduce a range of empty lines into one<br>
line only:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:v/./.,/./-1join</div>
<br>
The explanation for this command is below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:v/./&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Execute the following command for all lines not<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;containing a character (empty lines).<br>
&nbsp;&nbsp;&nbsp;&nbsp; .,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Use the current line as the start of the range of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lines.<br>
&nbsp;&nbsp;&nbsp;&nbsp; /./&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Use the line containing a character as the last line.<br>
&nbsp;&nbsp;&nbsp;&nbsp; -1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Adjust the range of lines to end with the line before<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the last line.<br>
&nbsp;&nbsp;&nbsp;&nbsp; j&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Join the lines in the range.</div>
<br>
<span class="Todo">Note</span>&nbsp;that this will give an error message if the empty lines are at the end<br>
of the file. To correct this, you have to add a temporary line at the end<br>
of the file, execute the command and then remove the temporary line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:v">:v</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:join">:join</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-ranges">cmdline-ranges</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#collapse">collapse</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.4" name="faq-12.4">faq-12.4</a><br>
12.4. How do I delete all blank lines in a file? How do I remove all the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lines containing only space characters?<br>
<br>
To remove all blank lines, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/^$/d</div>
<br>
To remove all lines with only whitespace (spaces or tabs) in them, use the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/^\s\+$/d</div>
<br>
To remove all the lines with only whitespace, if anything, use the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/^\s*$/d</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.5" name="faq-12.5">faq-12.5</a><br>
12.5. How do I copy/yank the current word?<br>
<br>
You can use the &quot;yiw&quot; (yank inner word without whitespace) command or the<br>
&quot;yaw&quot; (yank a word with whitespace) command to copy/yank the current<br>
word.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.6">04.6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.8">04.8</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#iw">iw</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#yank">yank</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#text-objects">text-objects</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="vimindex.html#objects">objects</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.6" name="faq-12.6">faq-12.6</a><br>
12.6. How do I yank text from one position to another position within a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line, without yanking the entire line?<br>
<br>
You can specify a motion command with the yank operator (y) to yank text<br>
from one position to another position within a line. For example, to yank<br>
from the current cursor position till the next letter x, use yfx or Fx or<br>
tx or Tx. To yank till the nth column, use n|. To yank till the next<br>
occurrence of a&nbsp;<span class="MissingTag">'word'</span>, use /word. To do a yank till the nth column on<br>
another line, first mark the position using the&nbsp;<a class="Type" href="options.html#'ma'">'ma'</a>&nbsp;command, go to the<br>
start of the yank position, and then yank till the mark using y`a (<span class="Todo">note</span>&nbsp;the<br>
direction of the quote)<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#yank">yank</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html">motion.txt</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.6">04.6</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.7" name="faq-12.7">faq-12.7</a><br>
12.7. When I yank some text into a register, how do I append the text to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the current contents of the register?<br>
<br>
When you specify the register for some operation, if you use the upper-case<br>
for the register name, then the new text will be appended to the existing<br>
contents. For example, if you have some text in the register &quot;a&quot;. If you<br>
want to append some new text to this, you have to use the &quot;A&quot; register<br>
name. If you use the lowercase register name, then the contents of the<br>
register will be overwritten with the new text.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote">quote</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote_alpha">quote_alpha</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.1">10.1</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.8" name="faq-12.8">faq-12.8</a><br>
12.8. How do I yank a complete sentence that spans over more than one line?<br>
<br>
To yank a complete sentence that spans over more than one line you have to<br>
use the yank operator followed by a motion command. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y)</div>
<br>
From inside the sentence you can use 'yi)' to yank the sentence.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#yank">yank</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#{motion}">{motion}</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#object-motions">object-motions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.6">04.6</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.9" name="faq-12.9">faq-12.9</a><br>
12.9. How do I yank all the lines containing a pattern into a buffer?<br>
<br>
You can use the &quot;:global&quot; command to yank all the lines containing the<br>
pattern into a register and then paste the contents of the register into<br>
the buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let @a=''<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/mypattern/y A</div>
<br>
The first command, clears the contents of the register &quot;a&quot;. The second<br>
command copies all the lines containing &quot;mypattern&quot; into the register &quot;a&quot;.<br>
<span class="Todo">Note</span>&nbsp;that the capital letter &quot;A&quot; is used to append the matched lines. Now<br>
you can paste the contents of register &quot;a&quot; to a buffer using &quot;ap command.<br>
<br>
If you only want to collect all matches, you can use a different<br>
approach. For that run the ':s' command with the flags&nbsp;<span class="MissingTag">'gn'</span>&nbsp;so that it<br>
won't actually&nbsp;&nbsp;change the buffer ('n' flag) but select each match ('g'<br>
flag). Combining this with the '\=' part in the replacement part, you<br>
can copy each match to e.g. a list. Altogether this looks like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let list=[]<br>
&nbsp;&nbsp;&nbsp;&nbsp;:%s/pattern/\=add(list, submatch(0))/gn</div>
<br>
Now all matches will be in the list and you can post process them as<br>
wanted.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:g">:g</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:y">:y</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-register">:let-register</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote_alpha">quote_alpha</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#put">put</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#registers">registers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:registers">:registers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-\=">sub-replace-\=</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.10" name="faq-12.10">faq-12.10</a><br>
12.10. How do I delete all the lines in a file that do not contain a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pattern?<br>
<br>
You can use &quot;:v&quot; command to delete all the lines that do not contain a<br>
pattern:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:v/pattern/d</div>
<br>
or<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g!/pattern/d</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:v">:v</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:g">:g</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.11" name="faq-12.11">faq-12.11</a><br>
12.11. How do I add a line before each line with &quot;pattern&quot; in it?<br>
<br>
You can use the following command to add a line before each line with<br>
&quot;pattern&quot; in it:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/pattern/normal! Oi&lt;line of text goes here&gt;</div>
<br>
Alternatively you can yank the line using the Y command and then insert the<br>
line using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/pattern/put!</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:g">:g</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:put">:put</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#insert">insert</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#0">0</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.12" name="faq-12.12">faq-12.12</a><br>
12.12. Is there a way to operate on a line if the previous line contains a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; particular pattern?<br>
<br>
You can use the &quot;:global&quot; command to operate on a line, if the previous<br>
line contains a particular pattern:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/&lt;pattern&gt;/+{cmd}</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:g">:g</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:range">:range</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.13" name="faq-12.13">faq-12.13</a><br>
12.13. How do I execute a command on all the lines containing a pattern?<br>
<br>
You can use the &quot;:global&quot; (:g) command to execute a command on all the<br>
lines containing a pattern.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/my pattern/d</div>
<br>
If you want to use a non-Ex command, then you can use the &quot;:normal&quot;<br>
command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/my pattern/normal {command}</div>
<br>
Unless you want the normal mode commands to be remapped, consider using a<br>
&quot;:normal!&quot; command instead (<span class="Todo">note</span>&nbsp;the &quot;!&quot;).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:global">:global</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:v">:v</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:normal">:normal</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.14" name="faq-12.14">faq-12.14</a><br>
12.14. Can I copy the character above the cursor to the current cursor<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; position?<br>
<br>
In Insert mode, you can copy the character above the cursor to the current<br>
cursor position by typing&nbsp;<span class="Special">&lt;Ctrl-Y&gt;</span>. The same can be done with the<br>
characters below the cursor by typing&nbsp;<span class="Special">&lt;Ctrl-E&gt;</span>.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-Y">i_CTRL-Y</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-E">i_CTRL-E</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.15" name="faq-12.15">faq-12.15</a><br>
12.15. How do I insert a blank line above/below the current line without<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; entering insert mode?<br>
<br>
You can use the &quot;:put&quot; ex command to insert blank lines. For example, try<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:put =''<br>
&nbsp;&nbsp;&nbsp;&nbsp;:put! =''</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:put">:put</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.16" name="faq-12.16">faq-12.16</a><br>
12.16. How do I insert the name of the current file into the current buffer?<br>
<br>
There are several ways to insert the name of the current file into the<br>
current buffer. In insert mode, you can use the&nbsp;<span class="Special">&lt;C-R&gt;</span>% or the<br>
<span class="Special">&lt;C-R&gt;</span>=expand(&quot;%&quot;) command. In normal mode, you can use the &quot;:put =@%&quot;<br>
command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R">i_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expand()">expand()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#!!">!!</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.17" name="faq-12.17">faq-12.17</a><br>
12.17. How do I insert the contents of a Vim register into the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer?<br>
<br>
In insert mode, you can use the&nbsp;<span class="Special">&lt;C-R&gt;&lt;register&gt;</span>&nbsp;command to insert the<br>
contents of&nbsp;<span class="Special">&lt;register&gt;</span>. For example, use&nbsp;<span class="Special">&lt;C-R&gt;</span>a to insert the contents<br>
of register &quot;a&quot; into the current buffer.<br>
<br>
In normal mode, you can use the &quot;:put&nbsp;<span class="Special">&lt;register&gt;</span>&quot; command to insert the<br>
contents of&nbsp;<span class="Special">&lt;register&gt;</span>. For example, use the &quot;:put d&quot; command to insert<br>
the contents of register &quot;d&quot; into the current buffer.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R">i_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-R">i_CTRL-R_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-O">i_CTRL-R_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-P">i_CTRL-R_CTRL-P</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:put">:put</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.18" name="faq-12.18">faq-12.18</a><br>
12.18. How do I move the cursor past the end of line and insert some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; characters at some columns after the end of the line?<br>
<br>
You can set the &quot;virtualedit&quot; option to move the cursor past the<br>
end-of-line and insert characters in a column after the end-of-line. To<br>
start the virtual mode, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set virtualedit=all</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'virtualedit'">'virtualedit'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.19" name="faq-12.19">faq-12.19</a><br>
12.19. How to replace the word under the cursor (say: junk) with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;foojunkbar&quot; in Vim?<br>
<br>
There are several ways to do this. If the word is the first such word on<br>
the line, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:exe &quot;s/&quot;.expand(&quot;&lt;cword&gt;&quot;).&quot;/foo&amp;bar/&quot;</div>
<br>
To match specifically you could use a more complex substitution like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:exe 's/\&lt;'.expand(&quot;&lt;cword&gt;&quot;).'\%&gt;'.(col(&quot;.&quot;)-1).'c\&gt;/foo&amp;bar/'</div>
<br>
You can also use the command: ciwfoo<span class="Special">&lt;C-R&gt;</span>&quot;bar<span class="Special">&lt;Esc&gt;</span><br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:substitute">:substitute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expand()">expand()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#col()">col()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%c">/\%c</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.20" name="faq-12.20">faq-12.20</a><br>
12.20. How do I replace a particular text in all the files in a directory?<br>
<br>
You can use the &quot;argdo&quot; command to execute the substitute command on all<br>
the files specified as arguments:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:args *<br>
&nbsp;&nbsp;&nbsp;&nbsp;:argdo %s/&lt;your_text&gt;/&lt;replacement_text&gt;/ge | update</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:args_f">:args_f</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:argdo">:argdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s_flags">:s_flags</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.21" name="faq-12.21">faq-12.21</a><br>
12.21. I have some numbers in a file. How do I increment or decrement the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; numbers in the file?<br>
<br>
You can use the&nbsp;<span class="Special">CTRL-A</span>&nbsp;key to increment the number and the&nbsp;<span class="Special">CTRL-X</span>&nbsp;key to<br>
decrement the number. You can also specify the number to<br>
increment/decrement from the number by specifying a count to the key. This<br>
works for decimal, octal and hexadecimal numbers. You can change the base<br>
used by Vim for this operation by modifying the&nbsp;<a class="Type" href="options.html#'nrformats'">'nrformats'</a>&nbsp;option.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_26.html#26.2">26.2</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#CTRL-A">CTRL-A</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#CTRL-X">CTRL-X</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'nrformats'">'nrformats'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.22" name="faq-12.22">faq-12.22</a><br>
12.22. How do I reuse the last used search pattern in a &quot;:substitute&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command?<br>
<br>
To reuse the last used search pattern in a &quot;:substitute&quot; command, don't<br>
specify a new search pattern:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:s/pattern/newtext/<br>
&nbsp;&nbsp;&nbsp;&nbsp;:s//sometext/</div>
<br>
In the second &quot;:s&quot; command, as a search pattern is not specified, the<br>
pattern specified in the first &quot;:s&quot; command&nbsp;<span class="MissingTag">'pattern'</span>&nbsp;will be used.<br>
<br>
If you want to change the search pattern but repeat the substitution<br>
pattern you can use the special right hand side, you can use the tilde<br>
character:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:s/newpattern/~/</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:s">:s</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:&">:&amp;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:~">:~</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#&">&amp;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.23" name="faq-12.23">faq-12.23</a><br>
12.23. How do I change the case of a string using the &quot;:substitute&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command?<br>
<br>
You can use special characters in the replacement string for a<br>
&quot;:substitute&quot; command to change the case of the matched string. For<br>
example, to change the case of the string &quot;MyString&quot; to all uppercase, you<br>
can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/MyString/\U&amp;/g</div>
<br>
To change the case to lowercase, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/MyString/\L&amp;/g</div>
<br>
To change the case of the first character in all the words in the current<br>
line to uppercase, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:s/\&lt;\(.\)\(\k*\)\&gt;/\u\1\L\2/g</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:substitute">:substitute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\U">/\U</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\L">/\L</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\u">/\u</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.24" name="faq-12.24">faq-12.24</a><br>
12.24. How do I enter characters that are not present in the keyboard?<br>
<br>
You can use digraphs to enter characters that are not present in the<br>
keyboard. You can use the &quot;:digraphs&quot; command to display all the currently<br>
defined digraphs. You can add a new digraph to the list using the<br>
&quot;:digraphs&quot; command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#digraphs">digraphs</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'digraph'">'digraph'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_24.html#24.9">24.9</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.25" name="faq-12.25">faq-12.25</a><br>
12.25. Is there a command to remove any or all digraphs?<br>
<br>
No. The digraphs table is defined at compile time. You can only add new<br>
ones. Adding a command to remove digraphs is on the todo list.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.26" name="faq-12.26">faq-12.26</a><br>
12.26. In insert mode, when I press the backspace key, it erases only the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; characters entered in this instance of insert mode. How do I erase<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; previously entered characters in insert mode using the backspace<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; key?<br>
<br>
This is traditional vi behaviour. You can set the&nbsp;<a class="Type" href="options.html#'backspace'">'backspace'</a>&nbsp;option to<br>
erase previously entered characters in insert mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set backspace=indent,eol,start</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backspace'">'backspace'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_backspacing">i_backspacing</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.27" name="faq-12.27">faq-12.27</a><br>
12.27. I have a file which has lines longer than 72 characters terminated<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; with &quot;+&quot; and wrapped to the next line. How can I quickly join the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lines?<br>
<br>
You can use the &quot;:global&quot; command to search and join the lines:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/+$/j</div>
<br>
This will, however, only join every second line. A couple of more complex<br>
examples which will join all consecutive lines with a &quot;+&quot; at the end are:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/*$/,/\(^\|[^+]\)$/j<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/+$/mark a | .,/\(^\|[^+]\)$/s/+$// | 'a,.j</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:g">:g</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:j">:j</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#:mark">:mark</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.28" name="faq-12.28">faq-12.28</a><br>
12.28. How do I paste characterwise yanked text into separate lines?<br>
<br>
You can use the &quot;:put&quot; command to paste characterwise yanked text into new<br>
lines:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:put =@&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:put">:put</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote_=">quote_=</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.29" name="faq-12.29">faq-12.29</a><br>
12.29. How do I change the case (uppercase, lowercase) of a word or a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; character or a block of text?<br>
<br>
You can use the &quot;~&quot; command to switch the case of a character.<br>
<br>
You can change the case of the word under the cursor to uppercase using the<br>
&quot;gUiw&quot; or &quot;viwU&quot; command and to lowercase using the &quot;guiw&quot; or &quot;viwu&quot;<br>
command.<br>
<br>
You can switch the case (upper case to lower case and vice versa) of the<br>
word under the cursor using the &quot;viw~&quot; or &quot;g~iw&quot; command.<br>
<br>
You can use the &quot;gUgU&quot; command to change the current line to uppercase and<br>
the &quot;gugu&quot; command to change the current line to lowercase.<br>
<br>
You can use the &quot;g~g~&quot; command to switch the case of the current line. You<br>
can use the &quot;g~<span class="Special">{motion}</span>&quot; or &quot;<span class="Special">{Visual}</span>~&quot; commands to switch the case of a<br>
block of text.<br>
<br>
If you set&nbsp;<a class="Type" href="options.html#'tildeop'">'tildeop'</a>&nbsp;the &quot;~&quot; command behaves like an operator and expects<br>
a motion command to act on. If you have&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set tildeop<br>
&nbsp;&nbsp;&nbsp;&nbsp;<br>
and you want to change the case from the current cursor position to the end<br>
of line, simply use &quot;~$&quot;.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#case">case</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'tildeop'">'tildeop'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.30" name="faq-12.30">faq-12.30</a><br>
12.30. How do I enter ASCII characters that are not present in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; keyboard?<br>
<br>
You can enter ASCII characters that are not present in the keyboard by<br>
pressing&nbsp;<span class="Special">CTRL-V</span>&nbsp;and then the ASCII character number. You can also use<br>
digraphs to enter special ASCII characters.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-V_digit">i_CTRL-V_digit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#digraphs">digraphs</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_45.html#45.5">45.5</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.31" name="faq-12.31">faq-12.31</a><br>
12.31. How do I replace non-printable characters in a file?<br>
<br>
To replace a non-printable character, you have to first determine the ASCII<br>
value for the character. You can use the &quot;:ascii&quot; ex command or the &quot;ga&quot;<br>
normal-mode command to display the ASCII value of the character under the<br>
cursor.<br>
<br>
You can enter the non-printable character by entering&nbsp;<span class="Special">CTRL-V</span>&nbsp;followed by<br>
the decimal number 1-255 (with no leading zero), or by x and a hex number<br>
00-FF, or by an octal number 0-0377 (with leading zero), or by u and a hex<br>
number 0-FFFF, or by U and a hex number 0-7FFFFFFF<br>
<br>
Another alternative is to use the &quot;:digraphs&quot; ex command to display the<br>
digraphs for all characters, together with their value in decimal and<br>
alpha. You can enter a non-printable character by entering&nbsp;<span class="Special">CTRL-K</span>&nbsp;followed<br>
by two alphanumeric characters (a digraph).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:ascii">:ascii</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-V">i_CTRL-V</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-V_digit">i_CTRL-V_digit</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#:digraphs">:digraphs</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.32" name="faq-12.32">faq-12.32</a><br>
12.32. How do I remove duplicate lines from a buffer?<br>
<br>
You can use the following user-defined command to remove all the duplicate<br>
lines from a buffer:<br>
<br>
:command -range=% Uniq&nbsp;<span class="Special">&lt;line1&gt;</span>,<span class="Special">&lt;line2&gt;</span>g/^\%&lt;<span class="Special">&lt;line2&gt;</span>l\(.*\)\n\1$/d<br>
<br>
Add the above command to your .vimrc file and invoke &quot;:Uniq&quot; to remove all<br>
the duplicate lines.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.33" name="faq-12.33">faq-12.33</a><br>
12.33. How do I prefix all the lines in a file with the corresponding line<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; numbers?<br>
<br>
You can prefix the lines in a file with the corresponding line number in<br>
several ways. Some of them are listed below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/^/\=line('.'). ' '<br>
&nbsp;&nbsp;&nbsp;&nbsp;:%s/^/\=printf('%5d ', line('.'))/<br>
&nbsp;&nbsp;&nbsp;&nbsp;:%s/^/\=strpart(line('.').'.&nbsp;&nbsp;&nbsp;&nbsp; ', 0, 5)<br>
&nbsp;&nbsp;&nbsp;&nbsp;:%s/^/\=strpart('&nbsp;&nbsp; ', strlen(line('.'))).line('.').'. '</div>
<br>
The last two commands will pad the line numbers with space characters.&nbsp;&nbsp;The<br>
last command will right align the numbers and the command before that will<br>
left align the numbers.<br>
<br>
If you don't want to number consecutive lines but rather non-consecutive<br>
regions, you can also use this idiom:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let i = 1<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/TODO/s/^/\=printf('%2d.',i)|let i+=1</div>
<br>
This first initializes the variable i with 1. In the next line, a :g<br>
command is used to perform a substitute command only on lines, that<br>
match 'TODO'. After the substitute command has taken place, the variable<br>
i will be incremented by 1.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#line()">line()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr6">expr6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#strpart()">strpart()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#printf()">printf()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:execute">:execute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:global">:global</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.34" name="faq-12.34">faq-12.34</a><br>
12.34. How do I exchange (swap) two characters or words or lines?<br>
<br>
You can exchange two characters with the &quot;xp&quot; command sequence. The 'x'<br>
will delete the character under the cursor and 'p' will paste the just<br>
deleted character after the character under the cursor. This will result<br>
in exchanging the two characters.<br>
<br>
You can exchange two words with the &quot;deep&quot; command sequence (start with the<br>
cursor in the blank space before the first word).<br>
<br>
You can exchange two lines with the &quot;ddp&quot; command sequence. The&nbsp;<span class="MissingTag">'dd'</span>&nbsp;will<br>
delete the current line and 'p' will paste the just deleted line after the<br>
current line. This will result in exchanging the two lines.&nbsp;<br>
<br>
All of the above operations will change the &quot; unnamed register.<br>
<br>
You can use the &quot;:m +&quot; ex command to exchange two lines without changing the<br>
unnamed register.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#x">x</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#p">p</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#dd">dd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#d">d</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#e">e</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#linewise-register">linewise-register</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quotequote">quotequote</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:move">:move</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-12.35" name="faq-12.35">faq-12.35</a><br>
12.35. How do I change the characters used as word delimiters?<br>
<br>
Vim uses the characters specified by the&nbsp;<a class="Type" href="options.html#'iskeyword'">'iskeyword'</a>&nbsp;option as word<br>
delimiters. The default setting for this option is &quot;@,48-57,_,192-255&quot;.<br>
<br>
For example, to add ':' as a word delimiter, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword+=:</div>
<br>
To remove '_' as a word delimiter, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set iskeyword-=_</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'iskeyword'">'iskeyword'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#word">word</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-13" name="faq-13">faq-13</a><br>
SECTION 13 - COMPLETION IN INSERT MODE<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-13.1" name="faq-13.1">faq-13.1</a><br>
13.1. How do I complete words or lines in insert mode?<br>
<br>
In insert mode, you can complete words using the&nbsp;<span class="Special">CTRL-P</span>&nbsp;and&nbsp;<span class="Special">CTRL-N</span>&nbsp;keys.<br>
The&nbsp;<span class="Special">CTRL-N</span>&nbsp;command searches forward for the next matching keyword.<br>
The&nbsp;<span class="Special">CTRL-P</span>&nbsp;command searches backwards for the next matching keyword.<br>
<br>
In insert mode, you can use the&nbsp;<span class="Special">CTRL-X</span>&nbsp;<span class="Special">CTRL-L</span>&nbsp;command sequence to complete<br>
lines that starts with the same characters as in the current line before<br>
the cursor. To get the next matching line, press the&nbsp;<span class="Special">CTRL-P</span>&nbsp;or&nbsp;<span class="Special">CTRL-N</span>&nbsp;keys.<br>
There are a lot of other keys/ways available to complete words in insert<br>
mode.<br>
<br>
Vim supports completion of the following items:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-L&nbsp;&nbsp;&nbsp;&nbsp;whole lines<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-N&nbsp;&nbsp;&nbsp;&nbsp;keywords in the current file<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-K&nbsp;&nbsp;&nbsp;&nbsp;words from a dictionary<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-T&nbsp;&nbsp;&nbsp;&nbsp;words from a thesaurus<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-I&nbsp;&nbsp;&nbsp;&nbsp;current and included files<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-]&nbsp;&nbsp;&nbsp;&nbsp;tags<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-F&nbsp;&nbsp;&nbsp;&nbsp;file names<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-D&nbsp;&nbsp;&nbsp;&nbsp;macro definitions (also in included files)<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-V&nbsp;&nbsp;&nbsp;&nbsp;Vim command line<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-U&nbsp;&nbsp;&nbsp;&nbsp;User defined completion<br>
&nbsp;&nbsp;&nbsp;&nbsp;CTRL-X CTRL-O&nbsp;&nbsp;&nbsp;&nbsp;Omni completion</div>
<br>
User defined completions and omni completions are often set by filetype<br>
plugins.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_24.html#24.3">24.3</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#ins-completion">ins-completion</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-13.2" name="faq-13.2">faq-13.2</a><br>
13.2. How do I complete file names in insert mode?<br>
<br>
In insert mode, you can use the&nbsp;<span class="Special">CTRL-X</span>&nbsp;<span class="Special">CTRL-F</span>&nbsp;command sequence to complete<br>
filenames that start with the same characters as in the current line before<br>
the cursor.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#compl-filename">compl-filename</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-13.3" name="faq-13.3">faq-13.3</a><br>
13.3. I am using&nbsp;<span class="Special">CTRL-P</span>/<span class="Special">CTRL-N</span>&nbsp;to complete words in insert mode. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;complete words that occur after the just completed word?<br>
<br>
You can use&nbsp;<span class="Special">CTRL-X</span>&nbsp;<span class="Special">CTRL-N</span>&nbsp;and&nbsp;<span class="Special">CTRL-X</span>&nbsp;<span class="Special">CTRL-P</span>&nbsp;keys to complete words that are<br>
present after the just completed word.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-X_CTRL-P">i_CTRL-X_CTRL-P</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-X_CTRL-N">i_CTRL-X_CTRL-N</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#ins-completion">ins-completion</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14" name="faq-14">faq-14</a><br>
SECTION 14 - TEXT FORMATTING<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.1" name="faq-14.1">faq-14.1</a><br>
14.1. How do I format a text paragraph so that a new line is inserted at<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the end of each wrapped line?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'gq'</span>&nbsp;command to format a paragraph. This will format the<br>
text according to the current&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;setting. An alternative would be<br>
to use the&nbsp;<span class="MissingTag">'gw'</span>&nbsp;command that formats like&nbsp;<span class="MissingTag">'gq'</span>&nbsp;but does not move the<br>
cursor.<br>
<br>
<span class="Todo">Note</span>&nbsp;that the gq operator can be used with a motion command to operate on a<br>
range of text. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;gqgq - Format the current line<br>
&nbsp;&nbsp;&nbsp;&nbsp;gqap - Format current paragraph<br>
&nbsp;&nbsp;&nbsp;&nbsp;gwap - Format current paragraph (and don't move cursor)<br>
&nbsp;&nbsp;&nbsp;&nbsp;gq3j - Format the current and the next 3 lines</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gq">gq</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gw">gw</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#formatting">formatting</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_25.html">usr_25.txt</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html">motion.txt</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.2" name="faq-14.2">faq-14.2</a><br>
14.2. How do I format long lines in a file so that each line contains less<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;than 'n' characters?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option to control the number of characters that<br>
can be present in a line. For example, to set the maximum width of a line<br>
to 70 characters, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;set textwidth=70</div>
<br>
Now to break the long lines in a file to the length defined by the<br>
<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:g/./normal gqq</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'textwidth'">'textwidth'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gq">gq</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.3" name="faq-14.3">faq-14.3</a><br>
14.3. How do I join short lines to form a paragraph?<br>
<br>
First, make sure the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option is set to a high value:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set textwidth=99999</div>
<br>
Next, join the short lines to form a paragraph using the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;1GgqG</div>
<br>
The above command will operate on the entire file. To do the formatting on<br>
all paragraphs in a specific range, use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:'a,'bg/\S/normal gq}</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gq">gq</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#G">G</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gqq">gqq</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.4" name="faq-14.4">faq-14.4</a><br>
14.4. How do I format bulleted and numbered lists?<br>
<br>
You can configure Vim to format bulleted and numbered lists using the<br>
<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option. For example, you can format the list of the<br>
following format:<br>
<br>
&nbsp;&nbsp;- this is a test. this is a test. this is a test. this is a test.<br>
&nbsp;&nbsp;this is a test.<br>
<br>
into this format:<br>
<br>
&nbsp;&nbsp;- this is a test. this is a test. this is a test. this is a test.<br>
&nbsp;&nbsp;&nbsp;&nbsp;this is a test.<br>
<br>
You can use the 'n' flag in the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;to align the text.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set fo+=n</div>
<br>
With this option, when formatting text, Vim will recognize numbered lists.<br>
For this option to work, the&nbsp;<a class="Type" href="options.html#'autoindent'">'autoindent'</a>&nbsp;option also must be set.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'formatoptions'">'formatoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#fo-table">fo-table</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#format-comments">format-comments</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.5" name="faq-14.5">faq-14.5</a><br>
14.5. How do I indent lines in insert mode?<br>
<br>
In insert mode, you can press the&nbsp;<span class="Special">CTRL-T</span>&nbsp;key to insert one shiftwidth of<br>
indent at the start of the current line. In insert mode, you can use the<br>
<span class="Special">CTRL-D</span>&nbsp;key to delete on shiftwidth of indent at the start of the current<br>
line. You can also use the&nbsp;<span class="Special">CTRL-O</span>&nbsp;&gt;&gt; and&nbsp;<span class="Special">CTRL-O</span>&nbsp;&lt;&lt; commands to indent the<br>
current line in insert mode.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-T">i_CTRL-T</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-D">i_CTRL-D</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_0_CTRL-D">i_0_CTRL-D</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#>>">&gt;&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#<<">&lt;&lt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.6" name="faq-14.6">faq-14.6</a><br>
14.6. How do I format/indent an entire file?<br>
<br>
You can format/indent an entire file using the gg=G command, where<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;gg - Goto the beginning of the file<br>
&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;&nbsp;- apply indentation<br>
&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;- till end of file</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gg">gg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#=">=</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#G">G</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'formatprg'">'formatprg'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="indent.html#C-indenting">C-indenting</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.7" name="faq-14.7">faq-14.7</a><br>
14.7. How do I increase or decrease the indentation of the current line?<br>
<br>
You can use the '&gt;&gt;' and '&lt;&lt;' commands to increase or decrease the<br>
indentation of the current line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#shift-left-right">shift-left-right</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#>>">&gt;&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#<<">&lt;&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'shiftwidth'">'shiftwidth'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.8" name="faq-14.8">faq-14.8</a><br>
14.8. How do I indent a block/group of lines?<br>
<br>
You can visually select the group of lines and press the &gt; or &lt; key to<br>
indent/unindent the lines. You can also use the following ex-command to<br>
indent the lines<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:10,20&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#shift-left-right">shift-left-right</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#v_>">v_&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#v_<">v_&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:<">:&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:>">:&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.9" name="faq-14.9">faq-14.9</a><br>
14.9. When I indent lines using the &gt; or &lt; key, the standard 8-tabstops are<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;used instead of the current&nbsp;<a class="Type" href="options.html#'tabstop'">'tabstop'</a>&nbsp;setting. Why?<br>
<br>
The number of spaces used when lines are indented using the &quot;&gt;&quot; operator is<br>
controlled by the&nbsp;<a class="Type" href="options.html#'shiftwidth'">'shiftwidth'</a>&nbsp;option. The&nbsp;<a class="Type" href="options.html#'tabstop'">'tabstop'</a>&nbsp;setting is only<br>
used, when the&nbsp;<a class="Type" href="options.html#'shiftwidth'">'shiftwidth'</a>&nbsp;option is zero.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set shiftwidth=4</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'shiftwidth'">'shiftwidth'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#>>">&gt;&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'softtabstop'">'softtabstop'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.10" name="faq-14.10">faq-14.10</a><br>
14.10. How do I turn off the automatic indentation of text?<br>
<br>
By default, the automatic indentation of text is not turned on. Check the<br>
configuration files (.vimrc, .gvimrc) for settings related to indentation.<br>
Make sure the &quot;:filetype indent on&quot; command is not present. If it is<br>
present, remove it. Also, depending on your preference, you may also want<br>
to check the value of the&nbsp;<a class="Type" href="options.html#'autoindent'">'autoindent'</a>,&nbsp;<a class="Type" href="options.html#'smartindent'">'smartindent'</a>,&nbsp;<a class="Type" href="options.html#'cindent'">'cindent'</a>&nbsp;and<br>
<a class="Type" href="options.html#'indentexpr'">'indentexpr'</a>&nbsp;options and turn them off as needed.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#:filetype-indent-off">:filetype-indent-off</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'autoindent'">'autoindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'smartindent'">'smartindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cindent'">'cindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'indentexpr'">'indentexpr'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.11" name="faq-14.11">faq-14.11</a><br>
14.11. How do I configure Vim to automatically set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to a particular value when I edit mails?<br>
<br>
You can use the 'FileType' autocommand to set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;autocmd FileType mail set tw=&lt;your_value&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#:autocmd">:autocmd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FileType">FileType</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_43.html">usr_43.txt</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.12" name="faq-14.12">faq-14.12</a><br>
14.12. Is there a way to make Vim auto-magically break lines?<br>
<br>
Yes. Set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option to the preferred length for a line. Then<br>
Vim will auto-magically break the newly entered lines. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set textwidth=75</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'textwidth'">'textwidth'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#ins-textwidth">ins-textwidth</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'formatoptions'">'formatoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#fo-table">fo-table</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#formatting">formatting</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.13" name="faq-14.13">faq-14.13</a><br>
14.13. I am seeing a lot of ^M symbols in my file. I tried setting the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'fileformat'">'fileformat'</a>&nbsp;option to&nbsp;<span class="MissingTag">'dos'</span>&nbsp;and then&nbsp;<span class="MissingTag">'unix'</span>&nbsp;and then&nbsp;<span class="MissingTag">'mac'</span>. None of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; these helped. How can I hide these symbols?<br>
<br>
When a file is loaded in Vim, the format of the file is determined as<br>
below:<br>
<br>
- If all the lines end with a new line (<span class="Special">&lt;NL&gt;</span>), then the fileformat is<br>
&nbsp;&nbsp;<span class="MissingTag">'unix'</span>.<br>
- If all the lines end with a carriage return (<span class="Special">&lt;CR&gt;</span>) followed by a new line<br>
&nbsp;&nbsp;(<span class="Special">&lt;NL&gt;</span>), then the fileformat is&nbsp;<span class="MissingTag">'dos'</span>.<br>
- If all the lines end with carriage return (<span class="Special">&lt;CR&gt;</span>), then the fileformat is<br>
&nbsp;&nbsp;<span class="MissingTag">'mac'</span>.<br>
<br>
If the file has some lines ending with&nbsp;<span class="Special">&lt;CR&gt;</span>&nbsp;and some lines ending with&nbsp;<span class="Special">&lt;CR&gt;</span><br>
followed by a&nbsp;<span class="Special">&lt;NL&gt;</span>, then the fileformat is set to&nbsp;<span class="MissingTag">'unix'</span>.<br>
<br>
You can change the format of the current file, by saving it explicitly in<br>
dos format:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:w ++ff=dos</div>
<br>
To display the format of the current file, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set fileformat?</div>
<br>
The above behavior is also controlled by the&nbsp;<a class="Type" href="options.html#'fileformats'">'fileformats'</a>&nbsp;option. You can<br>
try the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set fileformats+=unix<br>
&nbsp;&nbsp;&nbsp;&nbsp;:e &lt;your_file&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set fileformat=unix<br>
&nbsp;&nbsp;&nbsp;&nbsp;:w</div>
<br>
To remove the carriage return (<span class="Special">&lt;CR&gt;</span>) character at the end of all the lines<br>
in the current file, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/\r$//</div>
<br>
To force Vim to use a particular file format, when editing a file, you can<br>
use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e ++ff=dos filename</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileformats'">'fileformats'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileformat'">'fileformat'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#file-formats">file-formats</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#DOS-format-write">DOS-format-write</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#Unix-format-write">Unix-format-write</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#Mac-format-write">Mac-format-write</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="os_dos.html#dos-file-formats">dos-file-formats</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_23.html#23.1">23.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#++ff">++ff</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.14" name="faq-14.14">faq-14.14</a><br>
14.14. When I paste some text into a Vim buffer from another application,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the alignment (indentation) of the new text is messed up. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fix this?<br>
<br>
When you paste text into a GUI Vim using the mouse, Vim is able to<br>
detect that you are pasting text. So all the indentation related<br>
settings (like autoindent, smartindent, cindent, etc.) are ignored and<br>
the text is pasted literally.<br>
<br>
When pasting text into a Vim running in a terminal (like xterm) using<br>
the mouse, Vim may not be able to detect that you are pasting text. This<br>
depends on several things: the capability of the terminal to pass the<br>
mouse events to Vim, Vim is compiled to handle mouse events and access<br>
the clipboard, the DISPLAY variable is set properly, the Vim&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a><br>
option is set correctly.<br>
<br>
If Vim is able to detect that you are pasting text using the mouse, then<br>
the pasted text will be inserted literally.<br>
<br>
If Vim is not able to detect that you are pasting using the mouse, then<br>
it will see the pasted text as though you literally typed the text.<br>
After the first line from the pasted text is inserted, when Vim<br>
encounters the newline character, because of the indentation settings,<br>
the next line will start indented. The spaces at the beginning of the<br>
second line in the pasted text will be inserted leading to additional<br>
indentation. This will be repeated for subsequent lines. So the pasted<br>
text will be inserted with stair case indentation.<br>
<br>
You can fix this problem in a terminal Vim in several ways:<br>
<br>
1. Build Vim with the +mouse and +xterm_clipboard compile-time options.<br>
&nbsp;&nbsp; The normal or big or huge build of Vim includes these options.&nbsp;&nbsp;Set<br>
&nbsp;&nbsp; the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option to either 'a' or include 'i'.&nbsp;&nbsp;When pasting text<br>
&nbsp;&nbsp; using the mouse, don't press the Shift key. This will work only if<br>
&nbsp;&nbsp; Vim can access the X display. For more information, read the<br>
&nbsp;&nbsp; following Vim help topics:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#+feature-list">+feature-list</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'mouse'">'mouse'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#<MiddleMouse>">&lt;MiddleMouse&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#x11-selection">x11-selection</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#xterm-clipboard">xterm-clipboard</a><br>
<br>
1.1 Some Linux distributions build their terminal vim packages<br>
&nbsp;&nbsp;&nbsp;&nbsp;without X support.&nbsp;&nbsp;This makes no sense and leaves many users<br>
&nbsp;&nbsp;&nbsp;&nbsp;with the impression that Vim in terminal mode doesn't support<br>
&nbsp;&nbsp;&nbsp;&nbsp;some operations such as properly pasting text with a mouse.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;If your distribution includes gvim, which it almost certainly<br>
&nbsp;&nbsp;&nbsp;&nbsp;does these days, the solutions to this include the following.</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;a)&nbsp;&nbsp;Start Vim as<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gvim -v</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;b)&nbsp;&nbsp;Put this alias in your shell's configuration file, e.g.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.bashrc:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alias vim='gvim -v'</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;c)&nbsp;&nbsp;Put the following command in a file named&nbsp;<span class="MissingTag">'vim'</span>&nbsp;and put that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file in your ~/bin directory:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;gvim -v &quot;$@&quot;</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;d)&nbsp;&nbsp;Link the distribution's gvim to ~/bin/vim with the following<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command, which needs to be executed only once.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ln -s $(which gvim) ~/bin/vim</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;For c) and d), make sure that ~/bin precedes /usr/bin in your<br>
&nbsp;&nbsp;&nbsp;&nbsp;PATH.<br>
<br>
2. Paste the text using the&nbsp;<span class="Special">CTRL-R</span>&nbsp;<span class="Special">CTRL-O</span>&nbsp;* command.&nbsp;&nbsp;This will paste<br>
&nbsp;&nbsp; the text literally without any automatic indentation. If you want to<br>
&nbsp;&nbsp; paste the text and then fix the indentation, then you can use&nbsp;<span class="Special">CTRL-R</span><br>
<span class="Statement">&nbsp;&nbsp; CTRL-P&nbsp;</span>*. These commands will work only if Vim can access the X<br>
&nbsp;&nbsp; display. For more information, read the following Vim help topics:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-O">i_CTRL-R_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-P">i_CTRL-R_CTRL-P</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#quotestar">quotestar</a><br>
<br>
3. Set the&nbsp;<a class="Type" href="options.html#'paste'">'paste'</a>&nbsp;option before pasting the text. This option will<br>
&nbsp;&nbsp; disable the effect of all the indentation related settings. Make<br>
&nbsp;&nbsp; sure to turn off this option using ':set nopaste' after pasting the<br>
&nbsp;&nbsp; text. Otherwise the Vim indentation feature will not work.&nbsp;&nbsp;Do not<br>
&nbsp;&nbsp; permanently set the&nbsp;<a class="Type" href="options.html#'paste'">'paste'</a>&nbsp;option in your .vimrc file. If you are<br>
&nbsp;&nbsp; going to repeat these steps often, then you can set the<br>
&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'pastetoggle'">'pastetoggle'</a>&nbsp;option to a key. When you press the specified key,<br>
&nbsp;&nbsp; the&nbsp;<a class="Type" href="options.html#'paste'">'paste'</a>&nbsp;option will be toggled. You can press the key once<br>
&nbsp;&nbsp; before pasting the text and the press the key once after pasting<br>
&nbsp;&nbsp; the text.&nbsp;<span class="Todo">Note</span>&nbsp;that when the&nbsp;<a class="Type" href="options.html#'paste'">'paste'</a>&nbsp;option is set, all the<br>
&nbsp;&nbsp; mappings and abbreviations are disabled.&nbsp;&nbsp;For more information,<br>
&nbsp;&nbsp; read the following Vim help topics:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'paste'">'paste'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'pastetoggle'">'pastetoggle'</a><br>
<br>
You can also refer to the following topics in the user manual:&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.7">04.7</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_09.html#09.3">09.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.15" name="faq-14.15">faq-14.15</a><br>
14.15. When there is a very long wrapped line (wrap is &quot;on&quot;) and a line<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doesn't fit entirely on the screen it is not displayed at all. There<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;are blank lines beginning with '@' symbol instead of wrapped line. If<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I scroll the screen to fit the line the '@' symbols disappear and the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line is displayed again. What Vim setting control this behavior?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'display'">'display'</a>&nbsp;option to&nbsp;<span class="MissingTag">'lastline'</span>&nbsp;to display as much as<br>
possible of the last line in a window instead of displaying the '@'<br>
symbols.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set display=lastline</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'display'">'display'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.16" name="faq-14.16">faq-14.16</a><br>
14.16. How do I convert all the tab characters in a file to space<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; characters?<br>
<br>
You can use the &quot;:retab&quot; command to update all the tab characters in the<br>
current file with the current setting of&nbsp;<a class="Type" href="options.html#'expandtab'">'expandtab'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'tabstop'">'tabstop'</a>. For<br>
example, to convert all the tabs to white spaces, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set expandtab<br>
&nbsp;&nbsp;&nbsp;&nbsp;:retab</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:retab">:retab</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'expandtab'">'expandtab'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'tabstop'">'tabstop'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_25.html#25.3">25.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.17" name="faq-14.17">faq-14.17</a><br>
14.17. What Vim options can I use to edit text that will later go to a word<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; processor?<br>
<br>
You can set the following options to edit text that will later go into a<br>
word processor:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set wrap<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set linebreak<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set textwidth=0<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set showbreak=&gt;&gt;&gt;</div>
<br>
You can use the&nbsp;<span class="MissingTag">'gk'</span>&nbsp;and&nbsp;<span class="MissingTag">'gj'</span>&nbsp;commands to move one screen line up and down.<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'wrap'">'wrap'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'linebreak'">'linebreak'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'textwidth'">'textwidth'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'showbreak'">'showbreak'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gk">gk</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gj">gj</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-14.18" name="faq-14.18">faq-14.18</a><br>
14.18. How do I join lines without adding or removing any space characters?<br>
<br>
By default, when you join lines using the &quot;J&quot; or &quot;:join&quot; command, Vim will<br>
replace the line break, leading white space and trailing white space with a<br>
single space character. If there are space characters at the end of a line<br>
or a line starts with the ')' character, then Vim will not add a space<br>
character.<br>
<br>
To join lines without adding or removing any space characters, you can use<br>
the gJ or &quot;:join!&quot; commands.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#gJ">gJ</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:join">:join</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#J">J</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.5">10.5</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'joinspaces'">'joinspaces'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cpoptions'">'cpoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'formatoptions'">'formatoptions'</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15" name="faq-15">faq-15</a><br>
SECTION 15 - VISUAL MODE<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.1" name="faq-15.1">faq-15.1</a><br>
15.1. How do I do rectangular block copying?<br>
<br>
You can do rectangular block copying in Vim using the blockwise visual<br>
mode. To start blockwise visual mode use the&nbsp;<span class="Special">CTRL-V</span>&nbsp;key. Move the cursor<br>
using any of the motion commands and then use the y operator to yank to<br>
visually selected text.<br>
<br>
If&nbsp;<span class="Special">CTRL-V</span>&nbsp;does not work as expected, it may have been remapped to&nbsp;<span class="Special">CTRL-Q</span>&nbsp;by<br>
the mswin.vim script which is often sourced by a vimrc on Windows machines<br>
to mimic some common short cuts from other programs.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.4">04.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#blockwise-visual">blockwise-visual</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#visual-mode">visual-mode</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickref.html#Q_vi">Q_vi</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.2" name="faq-15.2">faq-15.2</a><br>
15.2. How do I delete or change a column of text in a file?<br>
<br>
You can use the Vim block-wise visual mode to select the column of text and<br>
apply an operator (delete, change, copy, etc) on it.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#visual-block">visual-block</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#visual-operators">visual-operators</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.3" name="faq-15.3">faq-15.3</a><br>
15.3. How do I apply an ex-command on a set of visually selected lines?<br>
<br>
When you select a range of lines in visual mode, the &lt; register is set to<br>
the start of the visual region and the &gt; register is set to the end of the<br>
visual region. You can use these registers to specify the range for an ex<br>
command. After visually selecting the lines, press &quot;:&quot; to go to the command<br>
mode.&nbsp;&nbsp;Vim will automatically insert the visual range '&lt;,'&gt;. You can run<br>
any ex-command on the visual range.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#v_:">v_:</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'<">'&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'>">'&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.4" name="faq-15.4">faq-15.4</a><br>
15.4. How do I execute an ex command on a column of text selected in Visual<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;block mode?<br>
<br>
All the ex commands operate on whole lines only. If you try to execute<br>
an ex command on a column of text selected in visual block mode, Vim<br>
will operate on all the selected lines (instead of the selected<br>
columns). You can use the vis.vim or NrrwRgn plugin script from<br>
<span class="Constant"><a href="http://vim.sourceforge.net">http://vim.sourceforge.net</a></span>&nbsp;scripts archive to do this.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-ranges">cmdline-ranges</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.3">10.3</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-lines">cmdline-lines</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.5" name="faq-15.5">faq-15.5</a><br>
15.5. How do I select the entire file in visual mode?<br>
<br>
You can select the entire file in visual mode using ggVG.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;gg - go to the beginning of the file.<br>
&nbsp;&nbsp;&nbsp;&nbsp;V&nbsp;&nbsp;- Start linewise visual mode<br>
&nbsp;&nbsp;&nbsp;&nbsp;G&nbsp;&nbsp;- goto the end of the file.</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#gg">gg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#linewise-visual">linewise-visual</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#G">G</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.6" name="faq-15.6">faq-15.6</a><br>
15.6. When I visually select a set of lines and press the &gt; key to indent<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the selected lines, the visual mode ends. How can I reselect the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;region for further operation?&nbsp;&nbsp;(or) How do I re-select the last<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selected visual area again?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'gv'</span>&nbsp;command to reselect the last selected visual area. You<br>
can also use the marks '&lt; and '&gt; to jump to the beginning or the end of the<br>
last selected visual area.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#gv">gv</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'<">'&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'>">'&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.7" name="faq-15.7">faq-15.7</a><br>
15.7. How do I jump to the beginning/end of a visually selected region?<br>
<br>
You can use the 'o' command to jump to the beginning/end of a visually<br>
selected region.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#v_o">v_o</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.8" name="faq-15.8">faq-15.8</a><br>
15.8. When I select text with mouse and then press : to enter an ex<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command, the selected text is replaced with the : character. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;execute an ex command on a text selected using the mouse similar to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the text selected using the visual mode?<br>
<br>
This will happen if you have configured Vim to use select mode instead of<br>
Visual mode by setting the&nbsp;<a class="Type" href="options.html#'selectmode'">'selectmode'</a>&nbsp;option. Check the value of this<br>
option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set selectmode?</div>
<br>
This mode is known as selectmode and is similar to the visual mode. This<br>
option is also automatically set when you use the &quot;behave mswin&quot; command.<br>
Select mode looks like visual mode, but it is similar to the selection mode<br>
in MS-Windows.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#Select-mode">Select-mode</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'selectmode'">'selectmode'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_09.html#09.4">09.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#:behave">:behave</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.9" name="faq-15.9">faq-15.9</a><br>
15.9. When I select a block of text using the mouse, Vim goes into<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;selection mode instead of Visual mode. Why?<br>
<br>
The&nbsp;<a class="Type" href="options.html#'selectmode'">'selectmode'</a>&nbsp;option controls whether Select mode will be started when<br>
selecting a block of text using the mouse. To start Visual mode when<br>
selecting text using mouse, remove the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;value from the&nbsp;<a class="Type" href="options.html#'selectmode'">'selectmode'</a><br>
option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set selectmode-=mouse</div>
<br>
<span class="Todo">Note</span>&nbsp;that by default, the&nbsp;<a class="Type" href="options.html#'selectmode'">'selectmode'</a>&nbsp;option will be set to empty, so that<br>
always visual mode is used.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'selectmode'">'selectmode'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#Select-mode">Select-mode</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#:behave">:behave</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-15.10" name="faq-15.10">faq-15.10</a><br>
15.10. How do I visually select the last copy/pasted text?<br>
<br>
You can use the '[ and '] marks to visually select the last copy/pasted<br>
text. The '[ mark is set to the beginning of the last changed/yanked text<br>
and the '] mark is set to the end of the last changed/yanked text. To<br>
visually select this block of text use the command '[v']<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'[">'[</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#']">']</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#`a">`a</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#v">v</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16" name="faq-16">faq-16</a><br>
SECTION 16 - COMMAND-LINE MODE<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.1" name="faq-16.1">faq-16.1</a><br>
16.1. How do I use the name of the current file in the command mode or an<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ex command line?<br>
<br>
In the command line, the '%' character represents the name of the current<br>
file. In some commands, you have to use expand(&quot;%&quot;) to get the filename:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:!perl %</div>
<br>
Another example is to load the latex generated pdf file from the file you<br>
are currently editing:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:!xpdf %&lt;.pdf</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:_%">:_%</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-special">cmdline-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expand()">expand()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.2" name="faq-16.2">faq-16.2</a><br>
16.2. How do I edit the text in the Vim command-line effectively?<br>
<br>
You can use the command-line window for editing Vim command-line text. To<br>
open the Vim command-line window use the &quot;q:&quot; command in normal mode. In<br>
command-line mode, use the&nbsp;<span class="Special">CTRL-F</span>&nbsp;key. In this window, the command line<br>
history will be displayed. You can use normal Vim keys/commands to edit any<br>
previous/new command line. To execute a command line, press the<br>
enter/return key.<br>
<br>
In a similar vain, the search history can be edited with &quot;q/&quot; and &quot;q?&quot;<br>
commands.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-window">cmdline-window</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.3" name="faq-16.3">faq-16.3</a><br>
16.3. How do I switch from Vi mode to Ex mode?<br>
<br>
You can use the Q command to switch from Vi mode to Ex mode. To switch from<br>
Ex mode back to the Vi mode, use the :vi command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#Q">Q</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#gQ">gQ</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#Ex-mode">Ex-mode</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:vi">:vi</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.4" name="faq-16.4">faq-16.4</a><br>
16.4. How do I copy the output from an ex-command into a buffer?<br>
<br>
To copy the output from an ex-command into a buffer, you have to first get<br>
the command output into a register. You can use the &quot;:redir&quot; command to get<br>
the output into a register. For example,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:redir @a<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/HelloWord/p<br>
&nbsp;&nbsp;&nbsp;&nbsp;:redir END</div>
<br>
Now the register 'a' will contain the output from the ex command<br>
&quot;g/HelloWord/p&quot;. Now you can paste the contents of the register 'a' into a<br>
buffer. You can also send or append the output of an ex-command into a file<br>
using the&nbsp;<span class="MissingTag">'redir'</span>&nbsp;command.<br>
<br>
You can prefix the &quot;:global&quot; command with &quot;:silent&quot;, to avoid having the<br>
lines printed to the screen.<br>
<br>
To redirect the output from an ex-command to a file, you can use the<br>
following set of commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:redir &gt; myfile<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/HelloWord/p<br>
&nbsp;&nbsp;&nbsp;&nbsp;:redir END</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:redir">:redir</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:silent">:silent</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.5" name="faq-16.5">faq-16.5</a><br>
16.5. When I press the tab key to complete the name of a file in the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command mode, if there are more than one matching file names, then<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim completes the first matching file name and displays a list of all<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matching filenames. How do I configure Vim to only display the list<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of all the matching filenames and not complete the first one?<br>
<br>
You can modify the&nbsp;<a class="Type" href="options.html#'wildmode'">'wildmode'</a>&nbsp;option to configure the way Vim completes<br>
filenames in the command mode. In this case, you can set the&nbsp;<a class="Type" href="options.html#'wildmode'">'wildmode'</a><br>
option to&nbsp;<a class="Type" href="options.html#'list'">'list'</a>:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set wildmode=list</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'wildmode'">'wildmode'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.6" name="faq-16.6">faq-16.6</a><br>
16.6. How do I copy text from a buffer to the command line and from the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command line to a buffer?<br>
<br>
To copy text from a buffer to the command line, after yanking the text from<br>
the buffer, use Ctrl-R 0 in the command line to paste the text. You can<br>
also yank the text to a specific register and use&nbsp;<span class="Special">CTRL-R</span>&nbsp;<span class="Special">&lt;register&gt;</span>&nbsp;to<br>
paste the text to the command line.&nbsp;&nbsp;You can use&nbsp;<span class="Special">CTRL-R</span>&nbsp;<span class="Special">CTRL-W</span>&nbsp;to paste the<br>
word under the cursor in the command line.<br>
<br>
To copy text from the command line into a buffer, you can paste the<br>
contents of the : register using the &quot;:p command. The most recently<br>
executed command line is stored in the : register.<br>
<br>
Another approach for copying and pasting text to and from the command line<br>
is to open the command line window using q: from normal mode or&nbsp;<span class="Special">CTRL-F</span>&nbsp;from<br>
the command-line mode. In the command line window you can use all the Vim<br>
commands to edit the command line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_CTRL-R">c_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote_:">quote_:</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-window">cmdline-window</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.7" name="faq-16.7">faq-16.7</a><br>
16.7. How do I put a command onto the command history without executing it?<br>
<br>
To put a command onto the command history without executing it, press the<br>
<span class="Special">&lt;Esc&gt;</span>&nbsp;key to cancel the command.<br>
<br>
An alternative solution, is to use the histadd() function like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:call histadd(':', 'echo strftime(&quot;%c&quot;)')</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_<Esc>">c_&lt;Esc&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#histadd()">histadd()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-16.8" name="faq-16.8">faq-16.8</a><br>
16.8. How do I increase the height of the command-line?<br>
<br>
You can increase the height of the command-line by changing the&nbsp;<a class="Type" href="options.html#'cmdheight'">'cmdheight'</a><br>
option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cmdheight=2</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cmdheight'">'cmdheight'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#hit-enter">hit-enter</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#05.7">05.7</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-17" name="faq-17">faq-17</a><br>
SECTION 17 - VIMINFO<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-17.1" name="faq-17.1">faq-17.1</a><br>
17.1. When I invoke Vim, I get error messages about illegal characters in<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the viminfo file. What should I do to get rid of these messages?<br>
<br>
You can remove the $HOME/.viminfo or the $HOME/_viminfo file to get rid of<br>
these error messages.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#viminfo-errors">viminfo-errors</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#viminfo-file-name">viminfo-file-name</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#viminfo">viminfo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_21.html#21.3">21.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-17.2" name="faq-17.2">faq-17.2</a><br>
17.2. How do I disable the viminfo feature?<br>
<br>
By default, the viminfo feature is disabled. If the viminfo feature is<br>
enabled by a system-wide vimrc file, then you can disable the viminfo<br>
feature by setting the&nbsp;<a class="Type" href="options.html#'viminfo'">'viminfo'</a>&nbsp;option to an empty string in your local<br>
.vimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set viminfo=&quot;&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viminfo'">'viminfo'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-17.3" name="faq-17.3">faq-17.3</a><br>
17.3. How do I save and use Vim marks/commands across Vim sessions?<br>
<br>
You can save and restore Vim marks across Vim sessions using the viminfo<br>
file. To use the viminfo file, make sure the&nbsp;<a class="Type" href="options.html#'viminfo'">'viminfo'</a>&nbsp;option is not empty.<br>
To save and restore Vim marks, the&nbsp;<a class="Type" href="options.html#'viminfo'">'viminfo'</a>&nbsp;option should not contain the<br>
'f' flag or should have a value greater than zero for the 'f' option.<br>
<br>
You can also use the viminfo file to synchronize the commandline history<br>
across different sessions using :wvimfo and :rviminfo commands together<br>
with the FocusGained and FocusLost autocommands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;augroup viminfo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;au!<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;au FocusLost&nbsp;&nbsp; * wviminfo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;au FocusGained * rviminfo<br>
&nbsp;&nbsp;&nbsp;&nbsp;augroup end</div>
<br>
<span class="Todo">Note</span>, this will only work reliably, when Vim can detect the FocusLost<br>
and FocusGained autocommands correctly. This means it should work with<br>
GVim but might depend on your terminal for konsole vim.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_21.html#21.3">21.3</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#viminfo">viminfo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viminfo'">'viminfo'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:wviminfo">:wviminfo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:rviminfo">:rviminfo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FocusLost">FocusLost</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FocusGained">FocusGained</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-18" name="faq-18">faq-18</a><br>
SECTION 18 - REMOTE EDITING<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-18.1" name="faq-18.1">faq-18.1</a><br>
18.1. How do I open a file with existing instance of gvim? What happened to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the Vim 5.x OpenWithVim.exe and SendToVim.exe files?<br>
<br>
Starting with Vim6, the OLE version of OpenWithVim.exe and SendToVim.exe<br>
Vim utilities are replaced by the new client-server feature. To open the<br>
file j.txt with an existing instance of Gvim (MyVim), use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ gvim --servername MyVim --remote-silent j.txt</div>
<br>
To list the server names of all the currently running Vim instances, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim --serverlist</div>
<br>
To get more information about client-server feature, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="remote.html#client-server">client-server</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-18.2" name="faq-18.2">faq-18.2</a><br>
18.2. How do I send a command to a Vim server to write all buffers to disk?<br>
<br>
You can use the Vim remote server functionality to do this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ gvim --servername myVIM --remote-send &quot;&lt;C-\&gt;&lt;C-N&gt;:wall&lt;CR&gt;&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="remote.html#client-server">client-server</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#CTRL-\_CTRL-N">CTRL-\_CTRL-N</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:wall">:wall</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-18.3" name="faq-18.3">faq-18.3</a><br>
18.3. Where can I get the documentation about the Vim remote server<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;functionality?<br>
<br>
You can get more information about the Vim remote server functionality by<br>
reading&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="remote.html#client-server">client-server</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19" name="faq-19">faq-19</a><br>
SECTION 19 - OPTIONS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.1" name="faq-19.1">faq-19.1</a><br>
19.1. How do I configure Vim in a simple way?<br>
<br>
You can use the &quot;:options&quot; command to open the Vim option window:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:options</div>
<br>
This window can be used for viewing and setting all the options.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:options">:options</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.2" name="faq-19.2">faq-19.2</a><br>
19.2. How do I toggle the value of an option?<br>
<br>
You can prefix the option with &quot;inv&quot; to toggle the value of the option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set invignorecase<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set invhlsearch</div>
<br>
You can also suffix the option with &quot;!&quot; to toggle the value:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set ignorecase!<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set hlsearch!</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#set-option">set-option</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.3" name="faq-19.3">faq-19.3</a><br>
19.3. How do I set an option that affects only the current buffer/window?<br>
<br>
Some of the Vim options can have a local or global value. A local value<br>
applies only to a specific buffer or window. A global value applies to all<br>
the buffers or windows.<br>
<br>
When a Vim option is modified using the &quot;:set&quot; command, both the global and<br>
local values for the option are changed. You can use the &quot;:setlocal&quot;<br>
command to modify only the local value for the option and the &quot;:setglobal&quot;<br>
command to modify only the global value.<br>
<br>
You can use the &quot;:setlocal&quot; command to set an option that will affect only<br>
the current file/buffer:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:setlocal textwidth=70</div>
<br>
<span class="Todo">Note</span>&nbsp;that not all options can have a local value. You can use &quot;:setlocal&quot;<br>
command to set an option locally to a buffer/window only if the option is<br>
allowed to have a local value.<br>
<br>
You can also use the following command to set an option locally:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let &amp;l:{option-name} = &lt;value&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:setlocal">:setlocal</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#local-options">local-options</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.4" name="faq-19.4">faq-19.4</a><br>
19.4. How do I use space characters for a Vim option value?<br>
<br>
To use space characters in a Vim option value, you have to escape the space<br>
character. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set tags=tags\ /usr/tags</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#option-backslash">option-backslash</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.5" name="faq-19.5">faq-19.5</a><br>
19.5. Can I add (embed) Vim option settings to the contents of a file?<br>
<br>
You can use modelines to add Vim option settings to the contents of a file.<br>
For example, in a C file, you can add the following line to the top or the<br>
bottom of the file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;/* vim&#0058;sw=4: */</div>
<br>
This will set the&nbsp;<a class="Type" href="options.html#'shiftwidth'">'shiftwidth'</a>&nbsp;option to 4, when editing that C file.<br>
For this to work, the&nbsp;<a class="Type" href="options.html#'modeline'">'modeline'</a>&nbsp;option should be set. By default, the<br>
<a class="Type" href="options.html#'modeline'">'modeline'</a>&nbsp;option is set. An alternative example is given in this document<br>
in the first line.<br>
<br>
The&nbsp;<a class="Type" href="options.html#'modelines'">'modelines'</a>&nbsp;settings specifies the number of<br>
lines that will be checked for the Vim set commands.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_21.html#21.6">21.6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#modeline">modeline</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#auto-setting">auto-setting</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'modeline'">'modeline'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'modelines'">'modelines'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.6" name="faq-19.6">faq-19.6</a><br>
19.6. How do I display the line numbers of all the lines in a file?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'number'">'number'</a>&nbsp;option to display the line numbers for all the<br>
lines.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set number</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'number'">'number'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.7" name="faq-19.7">faq-19.7</a><br>
19.7. How do I change the width of the line numbers displayed using the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;number&quot; option?<br>
<br>
You can set the minimum number of columns to be used for line numbering by<br>
setting the&nbsp;<a class="Type" href="options.html#'numberwidth'">'numberwidth'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set numberwidth=3</div>
<br>
This set's the width for the line number to 3 digits, which is enough, if<br>
your buffer contains less than 999 lines. However, if your current buffer<br>
contains more lines than 999, the&nbsp;<a class="Type" href="options.html#'numberwidth'">'numberwidth'</a>&nbsp;will be adjusted accordingly,<br>
so that the maximum line number will fit on the screen.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.8" name="faq-19.8">faq-19.8</a><br>
19.8. How do I display (view) all the invisible characters like space, tabs<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and newlines in a file?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option to see all the invisible characters in your<br>
file.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set list</div>
<br>
With this option set, you can view space characters, tabs, newlines,<br>
trailing space characters and wrapped lines.<br>
<br>
To not display the invisible characters (which is the default), you have to<br>
reset the&nbsp;<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nolist<br>
&nbsp;&nbsp;&nbsp;&nbsp;(or)<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set list!</div>
<br>
The &quot;:set list!&quot; command will toggle the current setting of the boolean<br>
<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option.<br>
<br>
You can modify the&nbsp;<a class="Type" href="options.html#'listchars'">'listchars'</a>&nbsp;option to configure how and which invisible<br>
characters are displayed. For example, with the following command all the<br>
trailing space characters will be displayed with a '.' character.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set listchars=trail:.</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'listchars'">'listchars'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'list'">'list'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.9" name="faq-19.9">faq-19.9</a><br>
19.9. How do I configure Vim to always display the current line and column<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;number?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'ruler'">'ruler'</a>&nbsp;option to display current column and line number in<br>
the status line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set ruler</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ruler'">'ruler'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.10" name="faq-19.10">faq-19.10</a><br>
19.10. How do I display the current Vim mode?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'showmode'">'showmode'</a>&nbsp;option to display the current Vim mode. In<br>
Insert, Replace and Visual modes, Vim will display the current mode on the<br>
last line.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set showmode</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'showmode'">'showmode'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.11" name="faq-19.11">faq-19.11</a><br>
19.11. How do I configure Vim to show pending/partial commands on the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; status line?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'showcmd'">'showcmd'</a>&nbsp;option to display pending/partial commands in the<br>
status line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set showcmd</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'showcmd'">'showcmd'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.12" name="faq-19.12">faq-19.12</a><br>
19.12. How do I configure the Vim status line to display different<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; settings/values?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'statusline'">'statusline'</a>&nbsp;option to display different values/settings in<br>
the Vim status line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'statusline'">'statusline'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'laststatus'">'laststatus'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'rulerformat'">'rulerformat'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ruler'">'ruler'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.13" name="faq-19.13">faq-19.13</a><br>
19.13. How do I configure Vim to display status line always?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'laststatus'">'laststatus'</a>&nbsp;option to 2 to display the status line always.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set laststatus=2</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'laststatus'">'laststatus'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.14" name="faq-19.14">faq-19.14</a><br>
19.14. How do I make a Vim setting persistent across different Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; invocations/instances/sessions?<br>
<br>
To make a Vim option setting persistent across different Vim instances, add<br>
your setting to the .vimrc or .gvimrc file. You can also use the &quot;:mkvimrc&quot;<br>
command to generate a vimrc file for the current settings.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#save-settings">save-settings</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#vimrc">vimrc</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#gvimrc">gvimrc</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#vimrc-intro">vimrc-intro</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:mkvimrc">:mkvimrc</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#initialization">initialization</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.15" name="faq-19.15">faq-19.15</a><br>
19.15. Why do I hear a beep (why does my window flash) about 1 second after<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I hit the Escape key?<br>
<br>
This is normal behavior. If your window flashes, then you've got the visual<br>
bell on. Otherwise, you should hear a beep.<br>
<br>
Vim needs a timeout to tell the difference between a simple escape and,<br>
say, a cursor key sequence.&nbsp;&nbsp;When you press a key in normal mode (and even<br>
in insert mode) and that key is the beginning of a mapping, Vim waits a<br>
certain amount of time to see if the rest of the mapping sequence follows.<br>
If the mapping sequence is completed before a given timeout period, the<br>
mapping for that sequence of keys is applied. If you interrupt the mapping,<br>
the normal actions associated with the keys are executed.<br>
<br>
For example, if you have a mapping defined as &quot;:imap vvv Vim is great!!&quot;<br>
and you type &quot;vvv&quot; quickly, the &quot;Vim is great!!&quot; will be inserted into your<br>
text. But if you type &quot;vv v&quot; then that is what will put into your text.<br>
This is also true if you type &quot;vvv&quot; too slowly where &quot;too slowly&quot; is longer<br>
than the value for the timeout option. Setting the timeout option to a<br>
larger value can help alleviate problems that appear when using function<br>
keys over a slow line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ttimeout'">'ttimeout'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.16" name="faq-19.16">faq-19.16</a><br>
19.16. How do I make the 'c' and 's' commands display a '$' instead of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; deleting the characters I'm changing?<br>
<br>
To make the 'c' and 's' commands display a '$' instead of deleting the<br>
characters, add the $ flag to the&nbsp;<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cpoptions+=$</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cpoptions'">'cpoptions'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-19.17" name="faq-19.17">faq-19.17</a><br>
19.17. How do I remove more than one flag using a single &quot;:set&quot; command<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from a Vim option?<br>
<br>
You can remove more than one flag from a Vim option using a single &quot;:set&quot;<br>
command, by specifying the flags in exactly the same order as they appear<br>
in the option. For example, if you use the following command to remove the<br>
't' and 'n' flags from the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set formatoptions-=tn</div>
<br>
The 't' and 'n' flags will be removed from the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option, only<br>
if the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option contains these flags in this order:&nbsp;<span class="MissingTag">'tn'</span>.<br>
Otherwise, it will not remove the flags. To avoid this problem, you can<br>
remove the flags one by one:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set formatoptions-=t formatoptions-=n</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:set-=">:set-=</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20" name="faq-20">faq-20</a><br>
SECTION 20 - MAPPING KEYS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.1" name="faq-20.1">faq-20.1</a><br>
20.1. How do I know what a key is mapped to?<br>
<br>
To see what a key is mapped to, use the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;key&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map! &lt;key&gt;</div>
<br>
You can also check the mappings in a particular mode using one of the<br>
&quot;:cmap&quot;, &quot;:nmap&quot;, &quot;:vmap&quot;, &quot;:imap&quot;, &quot;:omap&quot;, etc commands.<br>
<br>
To find out, where the key has been mapped, prefix the :verbose command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:verbose :map &lt;key&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-listing">map-listing</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-overview">map-overview</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.2" name="faq-20.2">faq-20.2</a><br>
20.2. How do I list all the user-defined key mappings?<br>
<br>
You can list all the user-defined key mappings using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-listing">map-listing</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.3" name="faq-20.3">faq-20.3</a><br>
20.3. How do I unmap a previously mapped key?<br>
<br>
You can unmap a previously mapped key using the &quot;:unmap&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:unmap &lt;key&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:unmap! &lt;key&gt;</div>
<br>
For mode specific mappings, you can use one of the<br>
&quot;:nunmap/:vunmap/:ounmap/:iunmap/:lunmap/:cunmap&quot; commands.<br>
<br>
The following command will fail to unmap a buffer-local mapped key:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:unmap &lt;key&gt;</div>
<br>
To unmap a buffer-local mapped key, you have to use the&nbsp;<span class="Special">&lt;buffer&gt;</span>&nbsp;keyword in<br>
the unmap command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:unmap &lt;buffer&gt; &lt;key&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:unmap! &lt;buffer&gt; &lt;key&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:unmap">:unmap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-modes">map-modes</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map-local">:map-local</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#mapleader">mapleader</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.4" name="faq-20.4">faq-20.4</a><br>
20.4. I am not able to create a mapping for the&nbsp;<span class="Special">&lt;xxx&gt;</span>&nbsp;key. What is wrong?<br>
<br>
1) First make sure, the key is passed correctly to Vim. To determine if<br>
&nbsp;&nbsp; this is the case, put Vim in Insert mode and then hit Ctrl-V (or<br>
&nbsp;&nbsp; Ctrl-Q if your Ctrl-V is remapped to the paste operation (e.g. on<br>
&nbsp;&nbsp; Windows if you are using the mswin.vim script file) followed by your<br>
&nbsp;&nbsp; key.<br>
<br>
&nbsp;&nbsp; If nothing appears in the buffer (and assuming that you have<br>
&nbsp;&nbsp;&nbsp;<a class="Type" href="options.html#'showcmd'">'showcmd'</a>&nbsp;on, ^V remains displayed near the bottom right of the Vim<br>
&nbsp;&nbsp; screen), then Vim doesn't get your key correctly and there is nothing<br>
&nbsp;&nbsp; to be done, other than selecting a different key for your mapping or<br>
&nbsp;&nbsp; using GVim, which should recognise the key correctly.<br>
<br>
2) Possibly, Vim gets your key, but sees it as no different than<br>
&nbsp;&nbsp; something else. Say you want to map Ctrl-Right, then in Insert mode<br>
&nbsp;&nbsp; hit Ctrl-K followed by Ctrl-Right. If Vim displays&nbsp;<span class="Special">&lt;C-Right&gt;</span>&nbsp;it has<br>
&nbsp;&nbsp; correctly seen the keystroke and you should be able to map it (by<br>
&nbsp;&nbsp; using&nbsp;<span class="Special">&lt;C-Right&gt;</span>&nbsp;as your&nbsp;<span class="Special">{lhs}</span>). If it displays&nbsp;<span class="Special">&lt;Right&gt;</span>&nbsp;it has seen<br>
&nbsp;&nbsp; the keystroke but as if you hadn't held Ctrl down: this means your<br>
&nbsp;&nbsp; temrinal passes Ctrl-Right as if it were just&nbsp;<span class="Special">&lt;Right&gt;</span>. Anything else<br>
&nbsp;&nbsp; means the key has been misidentified.<br>
<br>
3) If the key is seen, but not as itself and not as some recognizable<br>
&nbsp;&nbsp; key, then there is probably an error in the terminal library for the<br>
&nbsp;&nbsp; current terminal (termcap or terminfo database). In that case<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:set term?</div>
<br>
&nbsp;&nbsp; will tell you which termcap or terminfo Vim is using. You can try to<br>
&nbsp;&nbsp; tell vim, what termcode to use in that terminal, by adding the<br>
&nbsp;&nbsp; following to your vimrc:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if &amp;term == &lt;termname&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set &lt;C-Right&gt;=&lt;keycode&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
&nbsp;&nbsp; where&nbsp;<span class="Special">&lt;termname&gt;</span>&nbsp;above should be replaced by the value of&nbsp;<a class="Type" href="options.html#'term'">'term'</a><br>
&nbsp;&nbsp; (with quotes around it) and&nbsp;<span class="Special">&lt;keycode&gt;</span>&nbsp;by what you get when hitting<br>
&nbsp;&nbsp; Ctrl-V followed by Ctrl-Right in Insert mode (with nothing around<br>
&nbsp;&nbsp; it).&nbsp;<span class="Special">&lt;C-Right&gt;</span>&nbsp;should be left as-is (9 characters). Don't forget that<br>
&nbsp;&nbsp; in a :set command, white space is not allowed between the equal sign<br>
&nbsp;&nbsp; and the value, and any space, double quote, vertical bar or backslash<br>
&nbsp;&nbsp; present as part of the value must be backslash-escaped.<br>
<br>
&nbsp;&nbsp; Now you should be able to see the keycode corresponding to the key<br>
&nbsp;&nbsp; and you can create a mapping for the key using the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;C-Right&gt;&nbsp;&nbsp;&lt;your_command_to_be_mapped&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-keys-fails">map-keys-fails</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map-special-keys">:map-special-keys</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#key-codes">key-codes</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.5" name="faq-20.5">faq-20.5</a><br>
20.5. Why does mapping the &lt;C-...&gt; key not work?<br>
<br>
The only Ctrl-printable-key chords which Vim can reliably detect (because they<br>
are defined in the ASCII standard) are the following:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-@&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x00&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NUL<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-A to Ctrl-Z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x01 to 0x1A<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-a to Ctrl-z&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x01 to 0x1A<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-[&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x1B&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ESC<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x1C<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x1D<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-^&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x1E<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-_&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x1F<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ctrl-?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0x7F&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEL</div>
<br>
Most of these, however, already have a function in Vim (and some are<br>
aliases of other keys: Ctrl-H and Bsp, Ctrl-I and Tab, Ctrl-M and Enter,<br>
Ctrl-[ and Esc, Ctrl-? and Del).<br>
<br>
The &quot;safest&quot; keys to use in Vim for the&nbsp;<span class="Special">{lhs}</span>&nbsp;of a mapping are the F<br>
keys, with or without Shift:&nbsp;<span class="Special">&lt;F2&gt;</span>&nbsp;to&nbsp;<span class="Special">&lt;F12&gt;</span>&nbsp;and&nbsp;<span class="Special">&lt;S-F1&gt;</span>&nbsp;to&nbsp;<span class="Special">&lt;S-F12&gt;</span>. (Some<br>
OSes, including mine, intercept Ctrl-Fn and Alt-Fn, which never reach an<br>
application program such as vim or gvim).<br>
<br>
You can try other combinations of Ctrl + any key, but they may either<br>
not work everywhere (e.g. the terminal might not pass that key to Vim,<br>
or they might have unintended side effects (e.g. mapping&nbsp;<span class="Special">&lt;C-I&gt;</span>&nbsp;means<br>
also to map&nbsp;<span class="Special">&lt;Tab&gt;</span>).<br>
<br>
This is a known issue, that has been discussed and might be implemented<br>
in the future to enable Vim to distinguish between various keys even in<br>
console mode. (e.g.<br>
<span class="Constant"><a href="https://groups.google.com/d/msg/vim_dev/2bp9UdfZ63M/sajb9KM0pNYJ">https://groups.google.com/d/msg/vim_dev/2bp9UdfZ63M/sajb9KM0pNYJ</a></span>)<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.6" name="faq-20.6">faq-20.6</a><br>
20.6. How do I map the numeric keypad keys?<br>
<br>
First make sure that the numeric keypad keys are passed to Vim. Next, you<br>
can use the following command to map the numeric keypad keys:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;kSomething&gt;&nbsp;&nbsp;&lt;your_command&gt;</div>
<br>
where,&nbsp;<span class="Special">&lt;kSomething&gt;</span>&nbsp;can be kHome, kEnd, kPageUp, kPageDown, kPlus, kMinus,<br>
kDivide, kMultiply, kEnter, etc.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#key-codes">key-codes</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#terminal-options">terminal-options</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.7" name="faq-20.7">faq-20.7</a><br>
20.7. How do I create a mapping that works only in visual mode?<br>
<br>
You can create mappings that work only in specific modes (normal, command,<br>
insert, visual, etc). To create a mapping that works only in the visual<br>
mode, use the &quot;:vmap&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vmap &lt;F3&gt; &lt;your mapping here&gt;</div>
<br>
This mapping will work in visual and select mode. If you want the map to<br>
work only in visual mode (excluding select mode), use:<br>
<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:xmap &lt;F3&gt; &lt;your mapping here&gt;</div>
<br>
and to have the mapping only work in select mode (but not visual mode),<br>
use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:smap &lt;F3&gt; &lt;your mapping here&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:vmap">:vmap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:xmap">:xmap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:smap">:smap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-modes">map-modes</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_40.html#40.1">40.1</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.8" name="faq-20.8">faq-20.8</a><br>
20.8. How do I create a mapping that works only in normal and operator<br>
&nbsp;&nbsp; pending mode (but not in visual mode)?<br>
<br>
Using &quot;:map&quot; creates a mapping that works in normal, visual+select mode and<br>
operator pending mode. You can use &quot;:nmap&quot; to have the mapping only work in<br>
normal mode and &quot;:vmap&quot; to have the mapping only be defined for visual and<br>
select mode or use &quot;:omap&quot; to have the mapping only defined in operator<br>
pending mode.<br>
<br>
But if you want to have a mapping defined, that works in both operator<br>
pending mode and normal mode, but not in visual and select mode, you need<br>
to first define the mapping using &quot;:map&quot; and afterwards delete the mapping<br>
for visual and select mode:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:map&nbsp;<span class="Special">&lt;f3&gt;</span>&nbsp;&lt;your mapping here&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:vunmap&nbsp;<span class="Special">&lt;f3&gt;</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.9" name="faq-20.9">faq-20.9</a><br>
20.9. In a Vim script, how do I know which keys to use for my mappings, so<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;that the mapped key will not collide with an already used key?<br>
<br>
Vim uses most of the keys in the keyboard. You can use the&nbsp;<span class="Special">&lt;leader&gt;</span>&nbsp;prefix<br>
in maps to define keys which will not overlap with Vim keys. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;leader&gt;S &lt;C-W&gt;s<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;leader&gt;j &lt;C-W&gt;j<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;leader&gt;k &lt;C-W&gt;k</div>
<br>
where by default&nbsp;<span class="Special">&lt;leader&gt;</span>&nbsp;gets substituted with a backslash (\), so the<br>
user would enter<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\s<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\j<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\k</div>
<br>
to invoke the above map commands. The user can change the mapleader<br>
variable to be whatever they wanted:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let mapleader = &quot;,&quot;</div>
<br>
When writing a plugin or other script, more often than not, it is advisable<br>
to use :noremap instead of :map to avoid side effects from user defined<br>
mappings.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#<Leader>">&lt;Leader&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#<LocalLeader>">&lt;LocalLeader&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_41.html#write-plugin">write-plugin</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.10" name="faq-20.10">faq-20.10</a><br>
20.10. How do I map the escape key?<br>
<br>
You can map the Escape key to some other key using the &quot;:map&quot; command. For<br>
example, the following command maps the escape key to&nbsp;<span class="Special">CTRL-O</span>.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;C-O&gt; &lt;Esc&gt;</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.11" name="faq-20.11">faq-20.11</a><br>
20.11. How do I map a key to perform nothing?<br>
<br>
You can map a key to&nbsp;<span class="Special">&lt;Nop&gt;</span>&nbsp;to perform nothing when the key is pressed. For<br>
example, with the following mappings, the&nbsp;<span class="Special">&lt;F7&gt;</span>&nbsp;key will do nothing when<br>
pressed.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;F7&gt; &lt;Nop&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map! &lt;F7&gt; &lt;Nop&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#<Nop>">&lt;Nop&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map">:map</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map!">:map!</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-modes">map-modes</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.12" name="faq-20.12">faq-20.12</a><br>
20.12. I want to use the Tab key to indent a block of text and Shift-Tab<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; key to unindent a block of text. How do I map the keys to do this?<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This behavior is similar to textpad, visual studio, etc.<br>
<br>
Use the following mapping:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:inoremap &lt;S-Tab&gt; &lt;C-O&gt;&lt;lt&gt;&lt;lt&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;Tab&gt; &gt;&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;S-Tab&gt; &lt;lt&gt;&lt;lt&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:vnoremap &lt;Tab&gt; &gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:vnoremap &lt;S-Tab&gt; &lt;lt&gt;</div>
<br>
<span class="Todo">Note</span>, that the&nbsp;<span class="Special">&lt;S-Tab&gt;</span>&nbsp;mapping will work only if Vim receives the correct<br>
key sequence. This is mostly the case with GUI Vim.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:inoremap">:inoremap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:nnoremap">:nnoremap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:vnoremap">:vnoremap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#<S-Tab>">&lt;S-Tab&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#>>">&gt;&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#<<">&lt;&lt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#<lt>">&lt;lt&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.13" name="faq-20.13">faq-20.13</a><br>
20.13. In my mappings the special characters like&nbsp;<span class="Special">&lt;CR&gt;</span>&nbsp;are not recognized.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How can I configure Vim to recognize special characters?<br>
<br>
Check the value of the&nbsp;<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cpoptions?</div>
<br>
If this option contains the '&lt;' flag, then special characters will not be<br>
recognized in mappings. Remove the '&lt;' flag from&nbsp;<a class="Type" href="options.html#'cpoptions'">'cpoptions'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cpo-=&lt;</div>
<br>
Also, check the value of the&nbsp;<a class="Type" href="options.html#'compatible'">'compatible'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set compatible?</div>
<br>
The&nbsp;<a class="Type" href="options.html#'compatible'">'compatible'</a>&nbsp;option must be reset:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nocompatible</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cpoptions'">'cpoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'compatible'">'compatible'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.14" name="faq-20.14">faq-20.14</a><br>
20.14. How do I use the '|' to separate multiple commands in a map?<br>
<br>
You can escape the '|' character using backslash (\) to use '|' in a map.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map _l :!ls \| more&lt;CR&gt;</div>
<br>
You can also try the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map _l :!ls &lt;bar&gt; more&lt;CR&gt;</div>
<br>
There are also other ways to do this.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map_bar">map_bar</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.15" name="faq-20.15">faq-20.15</a><br>
20.15. If I have a mapping/abbreviation whose ending is the beginning of<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; another mapping/abbreviation, how do I keep the first from expanding<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; into the second one?<br>
<br>
Instead of using the &quot;:map lhs rhs&quot; command, use the &quot;:noremap lhs rhs&quot;<br>
command. For abbreviations, use &quot;noreabbrev lhs rhs&quot;. The &quot;nore&quot; prefix<br>
prevents the mapping or abbreviation from being expanded again.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:noremap">:noremap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:noreabbrev">:noreabbrev</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.16" name="faq-20.16">faq-20.16</a><br>
20.16. Why does it take a second or more for Vim to process a key,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sometimes when I press a key?<br>
<br>
Make sure you have not defined a mapping for this key using the following<br>
command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;key&gt;</div>
<br>
If a mapping is defined for this key and the mapped key contains more than<br>
one character, then Vim will wait for the next character to be pressed to<br>
determine whether it is the mapped key or not. For example, if you have<br>
mapped &quot;ab&quot;, then if you press &quot;a&quot;, Vim will wait for the next key to be<br>
pressed. If the next key is &quot;b&quot;, Vim will execute the mapped sequence.<br>
Otherwise, Vim will proceed with the normal processing of &quot;a&quot; followed by<br>
the next key. If the&nbsp;<a class="Type" href="options.html#'timeout'">'timeout'</a>&nbsp;option is set (which is the default), then<br>
Vim will timeout after waiting for the period specified with the<br>
<a class="Type" href="options.html#'timeoutlen'">'timeoutlen'</a>&nbsp;option (default is 1 second).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map-typing">map-typing</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'timeoutlen'">'timeoutlen'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ttimeoutlen'">'ttimeoutlen'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'timeout'">'timeout'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'ttimeout'">'ttimeout'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#vt100-cursor-keys">vt100-cursor-keys</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#slow-fast-terminal">slow-fast-terminal</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.17" name="faq-20.17">faq-20.17</a><br>
20.17. How do I map a key to run an external command using a visually<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; selected text?<br>
<br>
You can the &quot;:vmap&quot; command to map a key in the visual mode. In the mapped<br>
command sequence, you have to first yank the text. The yanked text is<br>
available in the '&quot;' register. Now, you can use the contents of this<br>
register to run the external command. For example, to run the external<br>
command &quot;perldoc&quot; on a visually selected text, you can use the following<br>
mapping:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vmap &lt;F7&gt; y:!exec &quot;!perldoc '&quot; . @&quot; . &quot;'&quot;&lt;CR&gt;</div>
<br>
If you want the mapping to work in the visual mode, but not with the<br>
highlighted text, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vmap &lt;F7&gt; :&lt;C-U&gt;!perldoc &lt;cword&gt;&lt;CR&gt;</div>
<br>
The above mapping will use the word under the cursor instead of the<br>
highlighted text.&nbsp;<span class="Todo">Note</span>&nbsp;the use of the&nbsp;<span class="Special">&lt;C-U&gt;</span>&nbsp;before invoking the &quot;perldoc&quot;<br>
external command. The&nbsp;<span class="Special">&lt;C-U&gt;</span>&nbsp;is used to erase the range of text selected in<br>
the visual mode and displayed on the command line. If the visual range is<br>
not removed using&nbsp;<span class="Special">&lt;C-U&gt;</span>, then the output from the external command will<br>
replace the visually selected text.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:vmap">:vmap</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#quote_quote">quote_quote</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-register">:let-register</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#c_CTRL-U">c_CTRL-U</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:!cmd">:!cmd</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.18" name="faq-20.18">faq-20.18</a><br>
20.18. How do I map the Ctrl-I key while still retaining the functionality<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; of the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key?<br>
<br>
The Ctrl-I key and the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key produce the same keycode, so Vim cannot<br>
distinguish between the Ctrl-I and the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key. When you map the Ctrl-I<br>
key, the&nbsp;<span class="Special">&lt;Tab&gt;</span>&nbsp;key is also mapped (and vice versa). The same restriction<br>
applies for the Ctrl-[ key and the&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;key.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#keycodes">keycodes</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.19" name="faq-20.19">faq-20.19</a><br>
20.19. How do I define a map to accept a count?<br>
<br>
Use the @= command to use an expression. For example,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;nnoremap = @='3l'</div>
<br>
Now you can specify a count to the '=' command.&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#complex-repeat">complex-repeat</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-20.20" name="faq-20.20">faq-20.20</a><br>
20.20. How can I make my normal mode mapping work from within Insert<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mode?<br>
<br>
Mappings in normal mode can be executed after&nbsp;<span class="Special">&lt;Ctrl-O&gt;</span>&nbsp;from insert mode as<br>
well but if there are more commands included in the mapping&nbsp;<span class="Special">{rhs}</span>, only the<br>
first one will be executed in normal mode and the rest of&nbsp;<span class="Special">{rhs}</span>&nbsp;will be<br>
printed literally in insert mode. One of ways to workaround this problem is<br>
to make&nbsp;<span class="Special">{rhs}</span>&nbsp;be one command, via wrapping it to the function. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;function GetFontNameOfFirstChar()<br>
&nbsp;&nbsp;&nbsp;&nbsp;normal! 0<br>
&nbsp;&nbsp;&nbsp;&nbsp;echo getfontname()<br>
&nbsp;&nbsp;&nbsp;&nbsp;endfunction</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nmap&nbsp;<span class="Special">&lt;F9&gt;</span>&nbsp;:call GetFontNameOfFirstChar()<span class="Special">&lt;CR&gt;</span><br>
<br>
A more technical and detailed solution to this problem follows and can<br>
be found at&nbsp;<span class="Constant"><a href="http://groups.google.com/group/vim_dev/msg/75f1f2dfc00908bb">http://groups.google.com/group/vim_dev/msg/75f1f2dfc00908bb</a></span><br>
<br>
Not every normal mode-mapping is automatically suitable for execution via<br>
<span class="Special">&lt;Ctrl-O&gt;</span>&nbsp;from within insert mode; you need to explicitly design your mappings<br>
for that purpose.<br>
<br>
The&nbsp;<span class="Special">&lt;Ctrl-O&gt;</span>&nbsp;command allows execution of one normal mode command from<br>
within insert mode, then returns to insert mode. If a normal mode mapping<br>
concatenates multiple normal mode commands, this breaks down in temporary<br>
normal mode and literally inserts the second part of the command into the<br>
buffer instead. To support execution of normal mode mappings from within<br>
insert mode, these strategies can be used:<br>
<br>
1) Instead of concatenating multiple normal mode commands, use one :normal<br>
&nbsp;&nbsp;&nbsp;&nbsp;mapping:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; zC :&lt;C-U&gt;normal! zCVzC&lt;CR&gt;</div>
<br>
2) Concatenate multiple Ex commands via&nbsp;<span class="Special">&lt;Bar&gt;</span>&nbsp;on the rhs:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap zC :&lt;C-U&gt;call MyMap1()&lt;Bar&gt;call MyMap2()&lt;CR&gt;</div>
<br>
3) Shadow normal mode mappings by insert mode mappings that<br>
&nbsp;&nbsp;&nbsp;&nbsp;re-enter normal mode, then invoke the normal mode mapping:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; &lt;SID&gt;MyMap2 :&lt;C-U&gt;call MyMap2()&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:inoremap &lt;silent&gt; &lt;script&gt; &lt;SID&gt;MyMap2 &lt;C-\&gt;&lt;C-O&gt;&lt;SID&gt;MyMap2<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; &lt;script&gt; zC &lt;SID&gt;MyMap1&lt;SID&gt;MyMap2</div>
<br>
4) Normal mode mappings that consist of multiple Ex command lines (and<br>
&nbsp;&nbsp;&nbsp;&nbsp;where Ex commands cannot be concatenated via&nbsp;<span class="Special">&lt;Bar&gt;</span>) replace ':<span class="Special">&lt;C-U&gt;</span>'<br>
&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;<span class="Special">&lt;SID&gt;</span>NM; the&nbsp;<span class="Special">&lt;SID&gt;</span>NM mapping enters normal mode for one ex command<br>
&nbsp;&nbsp;&nbsp;&nbsp;line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; &lt;SID&gt;NM :&lt;C-U&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:inoremap &lt;silent&gt; &lt;SID&gt;NM &lt;C-\&gt;&lt;C-O&gt;:<br>
&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap &lt;silent&gt; &lt;script&gt; zC &lt;SID&gt;MyMap1&lt;SID&gt;NMcall MyMap2()&lt;CR&gt;</div>
<br>
5)&nbsp;&nbsp;If none of the above is possible, at least force normal mode for<br>
&nbsp;&nbsp;&nbsp;&nbsp;subsequent commands via &lt;<span class="Special">CTRL-\</span>&gt;<span class="Special">&lt;CTRL-N&gt;</span>&nbsp;to avoid accidental insertion<br>
&nbsp;&nbsp;&nbsp;&nbsp;of the remainder of the mapping.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:nnoremap zC zC&lt;C-\&gt;&lt;C-N&gt;VzCzz</div>
<br>
<br>
For more information, read<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#map_bar">map_bar</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-\_CTRL-O">i_CTRL-\_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#CTRL-\_CTRL-N">CTRL-\_CTRL-N</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21" name="faq-21">faq-21</a><br>
SECTION 21 - ABBREVIATIONS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21.1" name="faq-21.1">faq-21.1</a><br>
21.1. How do I auto correct misspelled words?<br>
<br>
You can auto correct misspelled words using abbreviations. For example, the<br>
following abbreviation can be used to correct &quot;teh&quot; with &quot;the&quot;:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:abbreviate teh the</div>
<br>
Vim supports abbreviations in insert mode, replace mode and command-line<br>
mode.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_24.html#24.7">24.7</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#abbreviations">abbreviations</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickref.html#Q_ab">Q_ab</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21.2" name="faq-21.2">faq-21.2</a><br>
21.2. How do I create multi-line abbreviations?<br>
<br>
You can create multi-line abbreviations by embedding the &quot;<span class="Special">&lt;CR&gt;</span>&quot;<br>
key code in the text:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;iabbrev #c --------------&lt;CR&gt;-- Date:&lt;CR&gt;--&lt;CR&gt;---------</div>
<br>
With the above abbreviation, when you type #c, it will be expanded to<br>
the following text:<br>
<br>
<span class="PreProc">--------------</span><br>
-- Date:<br>
--<br>
<span class="PreProc">---------</span><br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#abbreviations">abbreviations</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21.3" name="faq-21.3">faq-21.3</a><br>
21.3. When my abbreviations are expanded, an additional space character is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;added at the end of the expanded text. How do I avoid this character?<br>
<br>
To avoid an additional space character at the end of the expanded text, you<br>
can expand the abbreviation by pressing the&nbsp;<span class="Special">CTRL-]</span>&nbsp;key.&nbsp;&nbsp;The abbreviation<br>
will be expanded without adding a space character at the end.<br>
<br>
Another alternative is to use the following function and command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;function! Eatchar(pat)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let c = nr2char(getchar())<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return (c =~ a:pat) ? '' : c<br>
&nbsp;&nbsp;&nbsp;&nbsp;endfunction<br>
&nbsp;&nbsp;&nbsp;&nbsp;command! -nargs=+ Iabbr execute &quot;iabbr&quot; &lt;q-args&gt; . &quot;&lt;C-R&gt;=Eatchar('\\s')&lt;CR&gt;&quot;</div>
<br>
Now, define your abbreviations using the new &quot;Iabbr&quot; command instead of the<br>
builtin &quot;iabbrev&quot; command. With this command, after expanding the<br>
abbreviated text, the next typed space character will be discarded.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#abbreviations">abbreviations</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21.4" name="faq-21.4">faq-21.4</a><br>
21.4. How do I insert the current date/time stamp into the file?<br>
<br>
You can use the strftime() function to insert the current data/time stamp<br>
in a file. For example, you can use the following abbreviation:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;iabbrev dts &lt;C-R&gt;=strftime(&quot;%y/%m/%d %H:%M&quot;)&lt;CR&gt;</div>
<br>
With this abbreviation, when you type dts in insert mode, it will be<br>
expanded to the date/time stamp.<br>
<br>
Some other forms of the above abbreviation are listed below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;iabbrev mdyl &lt;C-R&gt;=strftime(&quot;%a %d %b %Y&quot;)&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;iabbrev mdys &lt;C-R&gt;=strftime(&quot;%y%m%d&quot;)&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;iabbrev mdyc &lt;C-R&gt;=strftime(&quot;%c&quot;)&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;iabbrev hml&nbsp;&nbsp;&lt;C-R&gt;=strftime(&quot;%d/%m/%y %H:%M:%S&quot;)&lt;CR&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;iabbrev hms&nbsp;&nbsp;&lt;C-R&gt;=strftime(&quot;%H:%M:%S&quot;)&lt;CR&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#strftime()">strftime()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R">i_CTRL-R</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-21.5" name="faq-21.5">faq-21.5</a><br>
21.5. How do I prevent an abbreviation from expanding in insert mode?<br>
<br>
You can prevent an abbreviation from expanding in insert mode by typing<br>
<span class="Special">CTRL-V</span>&nbsp;before the character after the abbreviated word.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#abbreviations">abbreviations</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22" name="faq-22">faq-22</a><br>
SECTION 22 - RECORD AND PLAYBACK<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22.1" name="faq-22.1">faq-22.1</a><br>
22.1. How do I repeat an editing operation (insertion, deletion, paste,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;etc)?<br>
<br>
You can repeat the last editing operation using the '.' command. This will<br>
repeat the last simple change like a insert, delete, change, paste, etc.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_04.html#04.3">04.3</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#single-repeat">single-repeat</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickref.html#Q_re">Q_re</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22.2" name="faq-22.2">faq-22.2</a><br>
22.2. How I record and repeat a set of key sequences?<br>
<br>
You can use the 'q' command in normal mode to record a set of key sequences<br>
and store it in a register. For example, in the normal mode you can press q<br>
followed by a register name&nbsp;<span class="Special">{0-9a-bA-Z&quot;}</span>&nbsp;to start the recording.&nbsp;&nbsp;To<br>
end/stop the recording press q again. You can playback/repeat the recorded<br>
key sequences by pressing @ followed by the register name. e.g. @a.<br>
<br>
Another approach is to start Vim with the &quot;-w&quot; command-line argument.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -w &lt;file_name&gt;</div>
<br>
Vim will record all the characters typed in the session in the<br>
specified file &quot;file_name&quot;. You can use the recorded file with the &quot;-s&quot;<br>
command line argument to play it back:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -s &lt;file_name&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.1">10.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#recording">recording</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-w">-w</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-s">-s</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22.3" name="faq-22.3">faq-22.3</a><br>
22.3. How do I edit/modify a recorded set of key sequences?<br>
<br>
The recorded key sequences are stored in a register. You can paste the<br>
contents of the register into a Vim buffer, edit the pasted text and again<br>
yank the text into the register. You can also use the &quot;:let&quot; command to<br>
modify the register. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let @a = &quot;iHello World\&lt;Esc&gt;&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#recording">recording</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.1">10.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-register">:let-register</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#<>">&lt;&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cpoptions'">'cpoptions'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22.4" name="faq-22.4">faq-22.4</a><br>
22.4. How do I write recorded key sequences to a file?<br>
<br>
The recorded key sequences are stored in a register. You can paste the<br>
contents of the register into a Vim buffer. Now you can save the buffer<br>
into a file. You can also modify the pasted text and again yank into the<br>
register to modify the recorded key sequence. For example, if you record a<br>
set of key sequences using qa ..... q. The recorded key sequences are<br>
stored in the register 'a'. You can paste the contents of register 'a'<br>
using &quot;ap.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#recording">recording</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.1">10.1</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-22.5" name="faq-22.5">faq-22.5</a><br>
22.5. I am using register 0 to record my key sequences (i.e. q0 .... q).<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;In the recorded key sequences, I am yanking some text. After the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;first replay of the recorded key sequence, I am no longer able to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;play it back.<br>
<br>
Register 0 contains the text from the last yank operation. In your recorded<br>
key sequence, when the yank is performed, register 0 is overwritten with<br>
the yanked text. So your recording stored in register 0 is lost. You have<br>
to use some other register.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#registers">registers</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23" name="faq-23">faq-23</a><br>
SECTION 23 - AUTOCOMMANDS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.1" name="faq-23.1">faq-23.1</a><br>
23.1. How do I execute a command when I try to modify a read-only file?<br>
<br>
You can use the FileChangedRO autocommand event to execute a command when a<br>
read-only file is modified. For example, you can use this event to checkout a<br>
read-only file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd FileChangedRO * call MyCheckoutFunction()</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FileChangedRO">FileChangedRO</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.2" name="faq-23.2">faq-23.2</a><br>
23.2. How do I execute a command every time when entering a buffer?<br>
<br>
You can use the BufEnter autocommand event to execute a command every time<br>
when entering a buffer. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd BufEnter *.c set formatoptions=croqt</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#BufEnter">BufEnter</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.3" name="faq-23.3">faq-23.3</a><br>
23.3. How do I execute a command every time when entering a window?<br>
<br>
You can use the WinEnter autocommand event to execute a command every time<br>
when entering a window. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd WinEnter *.c call MyFunction()</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#WinEnter">WinEnter</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.4" name="faq-23.4">faq-23.4</a><br>
23.4. From an autocmd, how can I determine the name of the file or the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer number for which the autocommand is executed?<br>
<br>
You can use the special words&nbsp;<span class="Special">&lt;afile&gt;</span>&nbsp;or&nbsp;<span class="Special">&lt;abuf&gt;</span>&nbsp;in an autocmd to get the<br>
name of the file or the buffer number for which the autocommand is<br>
executed.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:<afile>">:&lt;afile&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:<abuf>">:&lt;abuf&gt;</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:<amatch>">:&lt;amatch&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.5" name="faq-23.5">faq-23.5</a><br>
23.5. How do I automatically save all the changed buffers whenever Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;loses focus?<br>
<br>
You can define an autocommand for the FocusLost event which will save all<br>
the modified buffers whenever Vim loses focus:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd FocusLost * wall</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#FocusLost">FocusLost</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:wall">:wall</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-23.6" name="faq-23.6">faq-23.6</a><br>
23.6. How do I execute/run a function when Vim exits to do some cleanup?<br>
<br>
You can use VimLeave autocmd event to execute a function just before Vim<br>
exits. For example,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:autocmd VimLeave * call MyCleanupFunction()</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#VimLeave">VimLeave</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24" name="faq-24">faq-24</a><br>
SECTION 24 - SYNTAX HIGHLIGHT<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.1" name="faq-24.1">faq-24.1</a><br>
24.1. How do I turn off/on syntax highlighting?<br>
<br>
By default, the Vim syntax highlighting is turned off. To enable the syntax<br>
highlighting, you can use one of the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:syntax enable</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;or<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:syntax on</div>
<br>
To disable the syntax highlighting, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:syntax off</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_06.html#06.1">06.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_06.html#06.4">06.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:syntax-enable">:syntax-enable</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:syntax-on">:syntax-on</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:syn-clear">:syn-clear</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.2" name="faq-24.2">faq-24.2</a><br>
24.2. How do I change the background and foreground colors used by Vim?<br>
<br>
Vim uses the &quot;Normal&quot; highlight group for the background and foreground<br>
colors. To change the foreground/background colors, you have to modify the<br>
&quot;Normal&quot; highlight group. For example, to set the background color to blue<br>
and foreground color to white, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:highlight Normal ctermbg=blue ctermfg=white guibg=blue guifg=white</div>
<br>
If you are using the Motif or the Athena version of the GUI Vim, then you<br>
can modify the foreground and background resource names in the .Xdefaults<br>
files to change the colors:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;Vim.foreground:&nbsp;&nbsp;&nbsp;&nbsp; Black<br>
&nbsp;&nbsp;&nbsp;&nbsp;Vim.backround:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Wheat</div>
<br>
You can also use the &quot;-foreground&quot; and &quot;-background&quot; command-line arguments<br>
to specify the foreground and background colors. These arguments are<br>
supported only in the Motif or Athena versions:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ gvim -foreground Black -background Wheat</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:highlight">:highlight</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#.Xdefaults">.Xdefaults</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-gui">-gui</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.3" name="faq-24.3">faq-24.3</a><br>
24.3. How do I change the highlight colors to suit a dark/light background?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'background'">'background'</a>&nbsp;option to either&nbsp;<span class="MissingTag">'dark'</span>&nbsp;or&nbsp;<span class="MissingTag">'light'</span>&nbsp;to change<br>
the highlight colors to suit a dark/light background:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set background=dark</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'background'">'background'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_06.html#06.2">06.2</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.4" name="faq-24.4">faq-24.4</a><br>
24.4. How do I change the color of the line numbers displayed when the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;:set number&quot; command is used?<br>
<br>
The line numbers displayed use the LineNr highlighting group. To display<br>
the current colors used, use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:hi LineNr</div>
<br>
To change the color modify the LineNr highlight group. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:hi linenr guifg=red guibg=black</div>
<br>
This will give red numbers on a black background in GVIM.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:highlight">:highlight</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.5" name="faq-24.5">faq-24.5</a><br>
24.5. How do I change the background color used for a Visually selected<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;block?<br>
<br>
You can modify the 'Visual' highlight group to change the color used for a<br>
visually selected block:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:highlight Visual guibg=red</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:highlight">:highlight</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#hl-Visual">hl-Visual</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.6" name="faq-24.6">faq-24.6</a><br>
24.6. How do I highlight the special characters (tabs, trailing spaces, end<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of line, etc) displayed by the&nbsp;<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option?<br>
<br>
You can modify the &quot;NonText&quot; and &quot;SpecialKey&quot; highlight groups to highlight<br>
the special characters displayed by the&nbsp;<a class="Type" href="options.html#'list'">'list'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:highlight NonText guibg=red<br>
&nbsp;&nbsp;&nbsp;&nbsp;:highlight SpecialKey guibg=green</div>
<br>
The &quot;NonText&quot; highlighting group is used for &quot;eol&quot;, &quot;extends&quot; and<br>
&quot;precedes&quot; settings in the &quot;listchars&quot; option.&nbsp;&nbsp;The &quot;SpecialKey&quot;<br>
highlighting group is used for the &quot;tab&quot; and &quot;trail&quot; settings.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'listchars'">'listchars'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#hl-NonText">hl-NonText</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#hl-SpecialKey">hl-SpecialKey</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.7" name="faq-24.7">faq-24.7</a><br>
24.7. How do I specify a colorscheme in my .vimrc/.gvimrc file, so that Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uses the specified colorscheme every time?<br>
<br>
You can specify the color scheme using the &quot;:colorscheme&quot; command in your<br>
.vimrc or .gvimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;colorscheme evening</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:colorscheme">:colorscheme</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.8" name="faq-24.8">faq-24.8</a><br>
24.8. Vim syntax highlighting is broken. When I am editing a file, some<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;parts of the file is not syntax highlighted or syntax highlighted<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;incorrectly.<br>
<br>
Vim doesn't read the whole file to parse the text for syntax highlighting.<br>
It starts parsing wherever you are viewing the file. That saves a lot of<br>
time, but sometimes the colors are wrong. A simple fix is refreshing the<br>
screen using the&nbsp;<span class="Special">CTRL-L</span>&nbsp;key. Or scroll back a bit and then forward again.<br>
You can also use the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:syntax sync fromstart</div>
<br>
<span class="Todo">Note</span>&nbsp;that this might considerably slow down the screen refreshing.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:syn-sync">:syn-sync</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:syn-sync-first">:syn-sync-first</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.9" name="faq-24.9">faq-24.9</a><br>
24.9. Is there a built-in function to syntax-highlight the corresponding<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matching bracket?<br>
<br>
Yes. Vim includes the matchparen Plugin as standard plugin that is enabled<br>
by default. Whenever the cursor moves over an item defined with the<br>
<a class="Type" href="options.html#'matchpairs'">'matchpairs'</a>&nbsp;option, Vim will highlight the corresponding bracket using the<br>
MatchParen highlighting group.<br>
<br>
However, if the corresponding parenthesis is not visible in the current<br>
window, the cursor won't jump to it.&nbsp;<br>
<br>
The matchit plugin provides a similar function, that lets the cursor<br>
jump to related items (e.g. &quot;if&quot;, &quot;else&quot;, &quot;endif&quot; items) and skips<br>
matches in comments. This uses the % command to jump to corresponding<br>
items. Though both plugins provide similar functions they are unrelated<br>
and work differently.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pi_paren.html#matchparen">matchparen</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'matchpairs'">'matchpairs'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#matchit-install">matchit-install</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="MissingTag">matchit-intro</span><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.10" name="faq-24.10">faq-24.10</a><br>
24.10. How do I turn off the C comment syntax highlighting?<br>
<br>
You can use the following command to turn off C comment syntax<br>
highlighting:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:highlight clear comment</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#ft-c-syntax">ft-c-syntax</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.11" name="faq-24.11">faq-24.11</a><br>
24.11. How do I add my own syntax extensions to the standard syntax files<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; supplied with Vim?<br>
<br>
You should not modify the syntax files supplied with Vim to add your<br>
extensions. When you install the next version of Vim, you will lose your<br>
changes. Instead you should create a file under the ~/.vim/after/syntax<br>
directory with the same name as the original syntax file and add your<br>
additions to this file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#mysyntaxfile-add">mysyntaxfile-add</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'runtimepath'">'runtimepath'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.12" name="faq-24.12">faq-24.12</a><br>
24.12. How do I replace a standard syntax file that comes with the Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; distribution with my own syntax file?<br>
<br>
You can replace a standard syntax file that comes with the Vim distribution<br>
by creating a file with the same name as the original syntax file and<br>
placing it in the vim runtime syntax (~/.vim/syntax) directory. For<br>
example, to replace the c.vim syntax file in a Unix system, place the new<br>
c.vim in the ~/.vim/syntax directory. In a MS-Windows system, place the new<br>
syntax file in the $HOME/vimfiles/syntax or $VIM/vimfiles/syntax directory.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#mysyntaxfile-replace">mysyntaxfile-replace</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_44.html#44.11">44.11</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#mysyntaxfile">mysyntaxfile</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.13" name="faq-24.13">faq-24.13</a><br>
24.13. How do I highlight all the characters after a particular column?<br>
<br>
You can use the &quot;:match&quot; command to highlight all the characters after a<br>
particular column:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:match Todo '\%&gt;75v.\+'</div>
<br>
This will highlight all the characters after the 75th column.<br>
<br>
You can also set the&nbsp;<a class="Type" href="options.html#'colorcolumn'">'colorcolumn'</a>&nbsp;option to highlight a particular<br>
column:<br>
<br>
&nbsp;&nbsp; :set colorcolumn=+2<br>
<br>
which highlights 2 columns after the current&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;setting<br>
(alternatively, you can use the exact column number).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#:match">:match</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\%v">/\%v</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/\+">/\+</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#/.">/.</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'colorcolumn'">'colorcolumn'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.14" name="faq-24.14">faq-24.14</a><br>
24.14. How do I convert a source file (.c, .h, etc) with the Vim syntax<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; highlighting into a HTML file?<br>
<br>
You can use the 2html.vim script to convert a source file into a HTML file<br>
with the Vim syntax highlighting. Use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:TOhtml</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#convert-to-HTML">convert-to-HTML</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:TOhtml">:TOhtml</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.15" name="faq-24.15">faq-24.15</a><br>
24.15. How do I list the definition of all the current highlight groups?<br>
<br>
You can list the definition of all the current highlight groups using the<br>
&quot;:highlight&quot; (without any arguments) ex command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#:highlight">:highlight</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-24.16" name="faq-24.16">faq-24.16</a><br>
24.16. How can I embed one syntax highlighting language into another one?<br>
<br>
It is possible to include one syntax highlighting into another one,<br>
however most of the currently deployed syntax highlighting scripts are<br>
not prepared to be included into another syntax script.<br>
<br>
You can however create your own custom script to define your own<br>
regions, which will be highlighted with a different language.<br>
<br>
See the wiki for a comprehensive solution:<br>
<span class="Constant"><a href="http://vim.wikia.com/wiki/Different_syntax_highlighting_within_regions_of_a_file">http://vim.wikia.com/wiki/Different_syntax_highlighting_within_regions_of_a_file</a></span><br>
<br>
For more information, read<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;|:syn-include|<br>
&nbsp;&nbsp;&nbsp;&nbsp;|sh-awk|<br>
&nbsp;&nbsp;&nbsp;&nbsp;</div>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25" name="faq-25">faq-25</a><br>
SECTION 25 - VIM SCRIPT WRITING<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.1" name="faq-25.1">faq-25.1</a><br>
25.1. How do I list the names of all the scripts sourced by Vim?<br>
<br>
You can use the &quot;:scriptnames&quot; command to list the names of all the scripts<br>
sourced by Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:scriptnames</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:scriptnames">:scriptnames</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.2" name="faq-25.2">faq-25.2</a><br>
25.2. How do I debug Vim scripts?<br>
<br>
Vim has built-in support for a primitive debugger to debug Vim plugins and<br>
scripts. Using this debugger you can set breakpoints and step through the<br>
plugin functions.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#debug-scripts">debug-scripts</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-D">-D</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.3" name="faq-25.3">faq-25.3</a><br>
25.3. How do I locate the script/plugin which sets a Vim option?<br>
<br>
You can use the &quot;:verbose&quot; command to locate the plugin/script which last<br>
modified a Vim option. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:verbose set textwidth?</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:set-verbose">:set-verbose</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:verbose">:verbose</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.4" name="faq-25.4">faq-25.4</a><br>
25.4. I am getting some error/informational messages from Vim (possibly<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when running a script), the messages are cleared immediately. How do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I display the messages again?<br>
<br>
You can use the &quot;:messages&quot; command to display the previous messages.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:messages</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#:messages">:messages</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:echoerr">:echoerr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:echomsg">:echomsg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#message-history">message-history</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.5" name="faq-25.5">faq-25.5</a><br>
25.5. How do I save and restore a plugin specific information across Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;invocations?<br>
<br>
Vim will save and restore global variables that start with an uppercase<br>
letter and don't contain a lower case letter. For this to work, the<br>
<a class="Type" href="options.html#'viminfo'">'viminfo'</a>&nbsp;option must contain the '!' flag. Vim will store the variables in<br>
the viminfo file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viminfo'">'viminfo'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#viminfo-file">viminfo-file</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#variables">variables</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.6" name="faq-25.6">faq-25.6</a><br>
25.6. How do I start insert mode from a Vim function?<br>
<br>
You can use the &quot;:startinsert&quot; command to start the insert mode from inside<br>
a Vim function.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#:startinsert">:startinsert</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.7" name="faq-25.7">faq-25.7</a><br>
25.7. How do I change the cursor position from within a Vim function?<br>
<br>
You can use the cursor() function to position the cursor.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;call cursor(lnum, col)</div>
<br>
Alternatively, use the setpos() function:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; call setpos('.', [bufnum, lnum, col, off])</div>
<br>
which set's the cursor in the buffer bufnum to line lnum, column col and<br>
offset for&nbsp;<a class="Type" href="options.html#'virtualedit'">'virtualedit'</a>. You can use the getpos() function, to return a<br>
list with these values, that can then be fed back to the setpos() function.<br>
<br>
If you want to save and restore the viewpoint on a window, use the<br>
winsaveview() and winrestview() function calls.<br>
<br>
You can also use the following command to change the cursor position:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exe &quot;normal! &quot; . lnum . &quot;G&quot; . col . &quot;|&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#cursor()">cursor()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#bar">bar</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#getpos()">getpos()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#setpos()">setpos()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#winsaveview()">winsaveview()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#winrestview()">winrestview()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.8" name="faq-25.8">faq-25.8</a><br>
25.8. How do I check the value of an environment variable in the .vimrc<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file?<br>
<br>
You can use prefix the environment variable name with the '$' character to<br>
use it from a Vim script/function.&nbsp;&nbsp;You can refer to the value of an<br>
environment variable using the $env_var syntax:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if $EDITOR == 'vi'<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr-env">expr-env</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.9" name="faq-25.9">faq-25.9</a><br>
25.9. How do I check whether an environment variable is set or not from a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim function?<br>
<br>
You can use the exists() function to check for the existence of an<br>
environment variable.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if exists(&quot;$MY_ENV_VAR&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#exists()">exists()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr-env">expr-env</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.10" name="faq-25.10">faq-25.10</a><br>
25.10. How do I call/use the Vim built-in functions?<br>
<br>
You can use the &quot;:call&quot; command to invoke a Vim built-in function:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:call cursor(10,20)</div>
<br>
You can use the &quot;:echo&quot; command to echo the value returned by a function:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo char2nr('a')</div>
<br>
You can use the &quot;:let&quot; command to assign the value returned by a function<br>
to a variable:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let a = getline('.')</div>
<br>
To store the return value from a function into a Vim register, you can use<br>
the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let @a = system('ls')</div>
<br>
The above command will store the return value from the&nbsp;<a class="Type" href="options.html#'ls'">'ls'</a>&nbsp;command into<br>
the register 'a'.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:call">:call</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:echo">:echo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let">:let</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-register">:let-register</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#user-functions">user-functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_41.html">usr_41.txt</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.11" name="faq-25.11">faq-25.11</a><br>
25.11. I am using some normal mode commands in my Vim script. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; avoid using the user-defined mappings for these normal mode commands<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and use the standard Vim functionality for these normal mode<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; commands?<br>
<br>
You can use the &quot;normal!&quot; command in your script to invoke a normal-mode<br>
command. This will use the standard functionality of the normal mode<br>
command and will not use the user-defined mapping.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:normal">:normal</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.12" name="faq-25.12">faq-25.12</a><br>
25.12. How do I get the current visually selected text into a Vim variable<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; or register?<br>
<br>
You can get the current visually selected text into a Vim variable by<br>
yanking the text into Vim register and then assigning the contents of the<br>
register into the variable:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:normal! gvy<br>
&nbsp;&nbsp;&nbsp;&nbsp;:let myvar = @&quot;</div>
<br>
The above command copies the visually selected text into the variable<br>
&quot;myvar&quot;.<br>
<br>
You can also use the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:normal! gv&quot;*y</div>
<br>
In the above command, gv reselects the last visually selected text and the<br>
rest of the command copies the selected text into the * (clipboard)<br>
register. Alternatively, you can set the 'a' flag in the&nbsp;<a class="Type" href="options.html#'guioptions'">'guioptions'</a><br>
option to automatically copy a visually selected text into the * register.<br>
To do this as part of a visual map, you can use a command similar to the<br>
one shown below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vmap &lt;F3&gt; &quot;*y:call ...</div>
<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#gv">gv</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:normal">:normal</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-@">:let-@</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#quotestar">quotestar</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#clipboard">clipboard</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#registers">registers</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.13" name="faq-25.13">faq-25.13</a><br>
25.13. I have some text in a Vim variable&nbsp;<span class="MissingTag">'myvar'</span>. I would like to use this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variable in a &quot;:s&quot; substitute command to replace a text&nbsp;<span class="MissingTag">'mytext'</span>.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; How do I do this?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'execute'</span>&nbsp;command to evaluate the variable:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:execute '%s/mytext/' . myvar . '/'</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:execute">:execute</a><br>
<br>
You can also use &quot;\=&quot; in the substitute command to evaluate the variable:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%s/mytext/\=myvar/</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#sub-replace-special">sub-replace-special</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.14" name="faq-25.14">faq-25.14</a><br>
25.14. A Vim variable (bno) contains a buffer number. How do I use this<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; variable to open the corresponding buffer?<br>
<br>
The :buffer command will not accept a variable name. It accepts only a<br>
buffer number or buffer name. You have to use the &quot;:execute&quot; command to<br>
evaluate the variable into the corresponding value. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:execute &quot;buffer &quot; . bno</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:execute">:execute</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.15" name="faq-25.15">faq-25.15</a><br>
25.15. How do I store the value of a Vim option into a Vim variable?<br>
<br>
You can prefix the option name with the '&amp;' character and assign the option<br>
value to a Vim variable using the &quot;let&quot; command. For example, to store the<br>
value of the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option into the Vim variable &quot;old_tw&quot;, you can use<br>
the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let old_tw = &amp;tw</div>
<br>
To explicitly save buffer local options, use the prefix &quot;l:&quot;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let old_tw = &amp;l:tw</div>
<br>
If you want to explicitly select the global option, use the &quot;g:&quot; prefix to<br>
the option name.<br>
<br>
To do the opposite, to set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option with the value stored in<br>
the 'old_tw' variable, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let &amp;tw = old_tw</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr-option">expr-option</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:let-option">:let-option</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.16" name="faq-25.16">faq-25.16</a><br>
25.16. I have copied and inserted some text into a buffer from a Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function. How do I indent the inserted text from the Vim function?<br>
<br>
You can use the following command to format the just inserted text:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:normal '[=']</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#'[">'[</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#']">']</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#=">=</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:normal">:normal</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.17" name="faq-25.17">faq-25.17</a><br>
25.17. How do I get the character under the cursor from a Vim script?<br>
<br>
You can use the getline() function and use string index [] to get the<br>
character:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo getline(&quot;.&quot;)[col(&quot;.&quot;) - 1]</div>
<br>
In the above command, getline(&quot;.&quot;) returns&nbsp;&nbsp;the text in the current line.<br>
The indexing of the string starts at zero, and you can get a single<br>
character in a string by its index with the &quot;string[index]&quot; notation. The<br>
col(&quot;.&quot;) returns the column of the cursor position; the adjustment is to<br>
get the right character of the string. However, this does NOT work with<br>
multibyte characters as this command only returns the byte index.<br>
<br>
Alternatively, you can use the following sequence of commands to get the<br>
character under the cursor:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;normal! vy<br>
&nbsp;&nbsp;&nbsp;&nbsp;let ch=@&quot;</div>
<br>
<span class="Todo">Note</span>, that the above commands will change the '&lt; and '&gt; marks.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#getline()">getline()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#col()">col()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr-[]">expr-[]</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.18" name="faq-25.18">faq-25.18</a><br>
25.18. How do I get the name of the current file without the extension?<br>
<br>
You can get the name of the current file without the extension using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo expand(&quot;%:r&quot;)</div>
<br>
With some commands, you can use the file name modifiers directly:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:cd %:p:h<br>
&nbsp;&nbsp;&nbsp;&nbsp;:!gcc -o %:r.o %<br>
&nbsp;&nbsp;&nbsp;&nbsp;:!xpdf %&lt;.pdf</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#filename-modifiers">filename-modifiers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expand()">expand()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-special">cmdline-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#fnamemodify()">fnamemodify()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.19" name="faq-25.19">faq-25.19</a><br>
25.19. How do I get the basename of the current file?<br>
<br>
You can use the :t filename modifier to get the basename of the current<br>
file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo expand(&quot;%:t&quot;)</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#filename-modifiers">filename-modifiers</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.20" name="faq-25.20">faq-25.20</a><br>
25.20. How do I get the output from a Vim function into the current buffer?<br>
<br>
You can insert the return value from a function using the following command<br>
in insert mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&lt;C-R&gt;=MyFunc()</div>
<br>
<span class="Todo">Note</span>, that this will only insert the return value of the function.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R">i_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-R">i_CTRL-R_CTRL-R</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-R_CTRL-O">i_CTRL-R_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expression">expression</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.21" name="faq-25.21">faq-25.21</a><br>
25.21. How do I call external programs from a Vim function?<br>
<br>
There are several ways to call external programs from a Vim function. You<br>
can use the builtin system() function to invoke external programs and get<br>
the result:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:let output = system(&quot;ls&quot;)</div>
<br>
You can also use &quot;!&quot; ex-command to run an external command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#system()">system()</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:!">:!</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.9">10.9</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.22" name="faq-25.22">faq-25.22</a><br>
25.22. How do I get the return status of a program executed using the &quot;:!&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command?<br>
<br>
You can use the predefined Vim v:shell_error variable to get the return<br>
status of the last run shell command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#v:shell_error">v:shell_error</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.23" name="faq-25.23">faq-25.23</a><br>
25.23. How do I determine whether the current buffer is modified or not?<br>
<br>
You can check the value of the&nbsp;<a class="Type" href="options.html#'modified'">'modified'</a>&nbsp;option to determine whether the<br>
current buffer is modified:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set modified?</div>
<br>
From a Vim script, you can check the value of the&nbsp;<a class="Type" href="options.html#'modified'">'modified'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if &amp;modified<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;File is modified&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'modified'">'modified'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.24" name="faq-25.24">faq-25.24</a><br>
25.24. I would like to use the carriage return character in a normal<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; command from a Vim script. How do I specify the carriage return<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; character?<br>
<br>
You can use the &quot;:execute&quot; command to specify the special (control)<br>
character in a normal mode command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:execute &quot;normal \&lt;CR&gt;&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:execute &quot;normal ixxx\&lt;Esc&gt;&quot;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:execute">:execute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#expr-quote">expr-quote</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.25" name="faq-25.25">faq-25.25</a><br>
25.25. How do I split long lines in a Vim script?<br>
<br>
You can split long lines in a Vim script by inserting the backslash<br>
character (&quot;\&quot;) at the start of the next line. For example,<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#line-continuation">line-continuation</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.26" name="faq-25.26">faq-25.26</a><br>
25.26. When I try to &quot;execute&quot; my function using the &quot;execute 'echo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Myfunc()'&quot; command, the cursor is moved to the top of the current<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer.&nbsp;&nbsp;Why?<br>
<br>
The &quot;:execute&quot; command runs the normal mode command specified by the<br>
argument. In the case of the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:execute &quot;echo Myfunc()&quot;</div>
<br>
The call to &quot;echo Myfunc()&quot; will return 0. The &quot;:execute&quot; command will run<br>
the normal mode command &quot;0&quot;, which moves the cursor to the top of the file.<br>
To call a Vim function, you should use the &quot;:call&quot; command instead of the<br>
&quot;:execute&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:call Myfunc()</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:call">:call</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:execute">:execute</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#:echo">:echo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#user-functions">user-functions</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_41.html#41.5">41.5</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_41.html#41.6">41.6</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.27" name="faq-25.27">faq-25.27</a><br>
25.27. How do I source/execute the contents of a register?<br>
<br>
If you have yanked a set of Vim commands into a Vim register (for example<br>
register 'a'), then you can source the contents of the register using one<br>
of the following commands:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;:@a<br>
or<br>
&nbsp;&nbsp;&nbsp;&nbsp;:exe @a<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:@">:@</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.28" name="faq-25.28">faq-25.28</a><br>
25.28. After calling a Vim function or a mapping, when I press the 'u'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; key to undo the last change, Vim undoes all the changes made by<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the mapping/function. Why?<br>
<br>
When you call a function or a mapping, all the operations performed by the<br>
function/mapping are treated as one single operation. When you undo the<br>
last operation by pressing 'u', all the changes made by the<br>
function/mapping are reversed.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="undo.html#undo-redo">undo-redo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#:map-undo">:map-undo</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.29" name="faq-25.29">faq-25.29</a><br>
25.29. How can I call a function defined with s: (script local function)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from another script/plugin?<br>
<br>
The s: prefix for a Vim function name is used to create a script local<br>
function. A script local function can be called only from within that<br>
script and cannot be called from other scripts. To define a function in a<br>
script/plugin, so that it can be called from other plugins/scripts, define<br>
the function without the s: prefix.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#script-variable">script-variable</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#script-local">script-local</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:scriptnames">:scriptnames</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-25.30" name="faq-25.30">faq-25.30</a><br>
25.30. Is it possible to un-source a sourced script? In other words, reverse<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; all the commands executed by sourcing a script.<br>
<br>
No. It is not possible to reverse or undo all the commands executed by<br>
sourcing a script.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:source">:source</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26" name="faq-26">faq-26</a><br>
SECTION 26 - PLUGINS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.1" name="faq-26.1">faq-26.1</a><br>
26.1. How do I set different options for different types of files?<br>
<br>
You can create filetype plugins to set different options for different<br>
types of files. You should first enable filetype plugins using the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:filetype plugin on</div>
<br>
A filetype plugin is a vim script that is loaded whenever Vim opens or<br>
creates a file of that type.&nbsp;&nbsp;For example, to ensure that the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a><br>
option is set to 80 when editing a C program (filetype 'c'), create one of<br>
the following files:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;~/.vim/ftplugin/c.vim (Unix)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;%HOME%\vimfiles\ftplugin\c.vim (Windows)</div>
<br>
with the following text in it:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;setlocal textwidth=80</div>
<br>
You can also use autocommands to set specific options when editing specific<br>
type of files. For example, to set the&nbsp;<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option to 75 for only<br>
*.txt files, you can use the following autocmd:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;autocmd BufRead *.txt setlocal textwidth=80</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_43.html#filetype-plugin">filetype-plugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#add-filetype-plugin">add-filetype-plugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#:autocmd">:autocmd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_40.html#40.3">40.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.2" name="faq-26.2">faq-26.2</a><br>
26.2. I have downloaded a Vim plugin or a syntax file or a indent file, or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;a color scheme or a filetype plugin from the web. Where should I copy<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;these files so that Vim will find them?<br>
<br>
You can place the Vim runtime files (plugins, syntax files, indent files,<br>
color schemes, filetype plugins, etc) under one of the directories<br>
specified in the&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>&nbsp;option. To determine the current value of<br>
the&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>&nbsp;option, use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set runtimepath</div>
<br>
For Unix systems, this is usually the &quot;$HOME/.vim&quot; directory. For MS-Windows<br>
systems, this is usually the $VIM\vimfiles or $HOME\vimfiles directory.<br>
Depending on the type of the runtime file, you have to place it under a<br>
specific directory under the above runtime directory. The names of the<br>
directories are listed below:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;colors/&nbsp;&nbsp; - color scheme files<br>
&nbsp;&nbsp;&nbsp;&nbsp;compiler/ - compiler files<br>
&nbsp;&nbsp;&nbsp;&nbsp;doc/&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- documentation<br>
&nbsp;&nbsp;&nbsp;&nbsp;ftplugin/ - filetype plugins<br>
&nbsp;&nbsp;&nbsp;&nbsp;indent/&nbsp;&nbsp; - indent scripts<br>
&nbsp;&nbsp;&nbsp;&nbsp;keymap/&nbsp;&nbsp; - key mapping files<br>
&nbsp;&nbsp;&nbsp;&nbsp;lang/&nbsp;&nbsp;&nbsp;&nbsp; - menu translations<br>
&nbsp;&nbsp;&nbsp;&nbsp;plugin/&nbsp;&nbsp; - plugin scripts<br>
&nbsp;&nbsp;&nbsp;&nbsp;syntax/&nbsp;&nbsp; - syntax files<br>
&nbsp;&nbsp;&nbsp;&nbsp;tutor/&nbsp;&nbsp;&nbsp;&nbsp;- files for vimtutor</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_43.html#your-runtime-dir">your-runtime-dir</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'runtimepath'">'runtimepath'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#:runtime">:runtime</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.3" name="faq-26.3">faq-26.3</a><br>
26.3. How do I extend an existing filetype plugin?<br>
<br>
You can extend an existing filetype plugin by creating a file in the<br>
after/ directory in any of the&nbsp;<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>&nbsp;directories.<br>
<br>
<br>
- for small changes to be done after (and in addition to) what is<br>
&nbsp;&nbsp;already done by the ftplugin installed with Vim, use an after-directory,<br>
&nbsp;&nbsp;as follows (replacing foobar by the&nbsp;<a class="Type" href="options.html#'filetype'">'filetype'</a>&nbsp;of the concerned<br>
&nbsp;&nbsp;files):<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;- For changes private to one user:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- on Windows:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$HOME/vimfiles/after/ftplugin/foobar.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- on Unix-like OSes:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$HOME/.vim/after/ftplugin/foobar.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;- For changes affecting all users on the system:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$VIM/vimfiles/after/ftplugin/foobar.vim</div>
<br>
- when replacing the whole filetype-plugin by a different version, or<br>
&nbsp;&nbsp;when installing a new ftplugin for some filetype not yet supported by<br>
&nbsp;&nbsp;Vim out of the box: use the same paths without the after/ in them. In<br>
&nbsp;&nbsp;that case you should place near the start of your plugin an &quot;if...<br>
&nbsp;&nbsp;finish... endif... let&quot; block like the one in the plugins distributed<br>
&nbsp;&nbsp;with Vim.<br>
<br>
All the above paths are given in Vim terminology (which is similar to<br>
Unix terminology, but is understood even by Vim for Windows); they don't<br>
exist by default, so the first time you need them you will have to<br>
create them using mkdir (on any OS including DOS/Windows) or md (on<br>
DOS/Windows only). $VIM and, on DOS/Windows, $HOME, do not necessarily<br>
exist outside Vim. If $HOME has no value (or no valid value) inside Vim,<br>
you can use $VIM instead; but on any but possibly very old versions of<br>
Windows, $HOMEDRIVE and $HOMEPATH are defined by the system, and if<br>
$HOME is undefined at Vim startup, Vim will set it by expanding<br>
$HOMEDRIVE$HOMEPATH before sourcing your vimrc. To know which values Vim<br>
uses, you can type (in a running Vim):<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:echo $VIM<br>
&nbsp;&nbsp;&nbsp;&nbsp;:echo $HOME</div>
<br>
<br>
If you placed the file in the after/ftplugin runtime directory, then Vim<br>
will first source the existing filetype plugin file and then will source<br>
the new file.&nbsp;&nbsp;If you placed the file in the $VIMRTUNTIME/ftplugin runtime<br>
directory, then Vim will first source the new file and then will source the<br>
existing filetype plugin file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#ftplugin-overrule">ftplugin-overrule</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_43.html#filetype-plugin">filetype-plugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#add-filetype-plugin">add-filetype-plugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'runtimepath'">'runtimepath'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.4" name="faq-26.4">faq-26.4</a><br>
26.4. How do I turn off loading the Vim plugins?<br>
<br>
You can reset the&nbsp;<a class="Type" href="options.html#'loadplugins'">'loadplugins'</a>&nbsp;option to turn off loading the plugins:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set noloadplugins</div>
<br>
You can also specify the &quot;--noplugin&quot; command line argument to stop loading<br>
the plugins:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim --noplugin</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'loadplugins'">'loadplugins'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#--noplugin">--noplugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#load-plugins">load-plugins</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.5" name="faq-26.5">faq-26.5</a><br>
26.5. How do I turn on/off loading the filetype plugins?<br>
<br>
By default, Vim will not load the filetype plugins. You can configure Vim<br>
to load filetype plugins using the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;filetype plugin on</div>
<br>
You can turn off loading the filetype plugins using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;filetype plugin off</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#:filetype-plugin-on">:filetype-plugin-on</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#:filetype-plugin-off">:filetype-plugin-off</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#:filetype">:filetype</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.6" name="faq-26.6">faq-26.6</a><br>
26.6. How do I override settings made in a file type plugin in the global<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ftplugin directory for all the file types?<br>
<br>
You can use an autocommand triggered on the FileType event:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;au Filetype * set formatoptions=xyz</div>
<br>
This should at least be after &quot;filetype on&quot; in your vimrc. Best is to put<br>
it in your &quot;myfiletypefile&quot; file, so that it's always last.<br>
<br>
If you want to override a setting for a particular filetype, then create a<br>
file with the same name as the original filetype plugin in the<br>
~/.vim/after/ftplugin directory For example, to override a setting in the<br>
c.vim filetype plugin, create a c.vim file in the ~/.vim/after/ftplugin<br>
directory and add your preferences in this file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#ftplugin-overrule">ftplugin-overrule</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_05.html#ftplugins">ftplugins</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#myfiletypefile">myfiletypefile</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.7" name="faq-26.7">faq-26.7</a><br>
26.7. How do I disable the Vim directory browser plugin?<br>
<br>
To disable the directory browsing Vim plugin, add the following line to<br>
your .vimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;let g:loaded_netrw = 1</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pi_netrw.html#netrw">netrw</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-26.8" name="faq-26.8">faq-26.8</a><br>
26.8. How do I set the filetype option for files with names matching a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;particular pattern or depending on the file extension?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'filetype'">'filetype'</a>&nbsp;option for files with names matching a<br>
particular pattern using an autocmd. For example, to set the&nbsp;<a class="Type" href="options.html#'filetype'">'filetype'</a><br>
option to 'c' for all files with extension '.x', you can use the following<br>
autocmd:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;autocmd! BufRead,BufNewFile *.x&nbsp;&nbsp;&nbsp;&nbsp; setfiletype c</div>
<br>
A better alternative to the above approach is to create a filetype.vim file<br>
in the ~/.vim directory (or in one of the directories specified in the<br>
<a class="Type" href="options.html#'runtimepath'">'runtimepath'</a>&nbsp;option) and add the following lines:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&quot; my filetype file<br>
&nbsp;&nbsp;&nbsp;&nbsp;if exists(&quot;did_load_filetypes&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;finish<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;augroup filetypedetect<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;au! BufRead,BufNewFile *.x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setfiletype c<br>
&nbsp;&nbsp;&nbsp;&nbsp;augroup END</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#new-filetype">new-filetype</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_43.html#43.2">43.2</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:setfiletype">:setfiletype</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27" name="faq-27">faq-27</a><br>
SECTION 27 - EDITING PROGRAM FILES<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.1" name="faq-27.1">faq-27.1</a><br>
27.1. How do I enable automatic indentation for C/C++ files?<br>
<br>
You can enable file-type based indentation using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:filetype indent on</div>
<br>
If you want to only enable automatic C indentation, then use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cindent</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cindent'">'cindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="indent.html#C-indenting">C-indenting</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#filetype">filetype</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.2" name="faq-27.2">faq-27.2</a><br>
27.2. How do I configure the indentation used for C/C++ files?<br>
<br>
You can configure the Vim C indentation by modifying the value of the<br>
<a class="Type" href="options.html#'cinoptions'">'cinoptions'</a>,&nbsp;<a class="Type" href="options.html#'cinkeys'">'cinkeys'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'cinwords'">'cinwords'</a>&nbsp;options.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cindent'">'cindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cinoptions'">'cinoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cinkeys'">'cinkeys'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cinwords'">'cinwords'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="indent.html#C-indenting">C-indenting</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="indent.html#cinoptions-values">cinoptions-values</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'smartindent'">'smartindent'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.3" name="faq-27.3">faq-27.3</a><br>
27.3. How do I turn off the automatic indentation feature?<br>
<br>
By default, the automatic indentation is not turned on. You must have<br>
configured Vim to do automatic indentation in either .vimrc or .gvimrc<br>
files. You can disable automatic indentation using either,<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:filetype indent off</div>
<br>
or<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set nocindent</div>
<br>
Also, check the setting for the following options:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set autoindent?<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set smartindent?<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set indentexpr?</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cindent'">'cindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#:filetype-indent-off">:filetype-indent-off</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'autoindent'">'autoindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'smartindent'">'smartindent'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'indentexpr'">'indentexpr'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.4" name="faq-27.4">faq-27.4</a><br>
27.4. How do I change the number of space characters used for the automatic<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;indentation?<br>
<br>
You can modify the&nbsp;<a class="Type" href="options.html#'shiftwidth'">'shiftwidth'</a>&nbsp;option to change the number of space<br>
characters used for the automatic indentation:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set shiftwidth=4</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'shiftwidth'">'shiftwidth'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.5" name="faq-27.5">faq-27.5</a><br>
27.5. I am editing a C program using Vim. How do I display the definition<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;of a macro or a variable?<br>
<br>
You can use the &quot;[d&quot; command to display the definition of a macro, &quot;[i&quot;<br>
command to display the definition of a variable, &quot;gd&quot; to goto the local<br>
declaration of a variable and &quot;gD&quot; to go to the global Declaration.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tagsrch.html#[d">[d</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tagsrch.html#[i">[i</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#gd">gd</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="pattern.html#gD">gD</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tagsrch.html#include-search">include-search</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_29.html#29.4">29.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_29.html#29.5">29.5</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.6" name="faq-27.6">faq-27.6</a><br>
27.6. I am editing a C program using Vim. How do I jump to the beginning or<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end of a code block from within the block?<br>
<br>
You can use '[{' command to jump to the beginning of the code block and ']}<br>
to jump to the end of the code block from inside the block.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#[{">[{</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#]}">]}</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#various-motions">various-motions</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.7" name="faq-27.7">faq-27.7</a><br>
27.7. When editing C++ files and when inserting new lines above or below a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;comment (//) line, Vim automatically inserts the C++ comment<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;character (//) at the beginning of the line. How do I disable this?<br>
<br>
This automatic insertion of the comment leader (//) when new lines<br>
are added is controlled by three flags in the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a><br>
option:&nbsp;&nbsp;'c', 'r' and 'o'.&nbsp;&nbsp;'c' enables auto-wrapping of comment<br>
lines when typing extends beyond the right margin.&nbsp;&nbsp;'r' enables the<br>
automatic insertion of the comment leader when&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;is pressed<br>
while editing a comment line.&nbsp;&nbsp;'o' enables the automatic insertion<br>
of the comment leader when a new line is opened above or below an<br>
existing comment line by typing O or o in Normal mode.<br>
<br>
You can stop Vim from automatically inserting the comment leader<br>
when typing&nbsp;<span class="Special">&lt;Enter&gt;</span>&nbsp;within a comment or when opening a new line by<br>
removing the 'r' and 'o' flags from&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>.<br>
<br>
&nbsp;&nbsp; :set formatoptions-=r<br>
&nbsp;&nbsp; :set formatoptions-=o<br>
<br>
The default filetype plugin for C and C++ files<br>
($VIMRUNTIME/ftplugin/c.vim) adds the 'r' and 'o' flags to the<br>
<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option.&nbsp;&nbsp;If you want to override this for C++ files,<br>
then you can add the above lines to the<br>
~/.vim/after/ftplugin/cpp.vim file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<span class="MissingTag">formatoptions</span><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_30.html#30.6">30.6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#format-comments">format-comments</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#filetype-plugins">filetype-plugins</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#ftplugin-overrule">ftplugin-overrule</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.8" name="faq-27.8">faq-27.8</a><br>
27.8. How do I add the comment character '#' to a set of lines at the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;beginning of each line?<br>
<br>
First, select the first character in all the lines using visual block mode<br>
(<span class="Special">CTRL-V</span>). Press 'I' to start inserting characters at the beginning of the<br>
line. Enter the comment character and then stop the insert mode by pressing<br>
<span class="Special">&lt;Esc&gt;</span>. Vim will automatically insert the entered characters at the<br>
beginning of all the selected lines.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#visual-block">visual-block</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#blockwise-operators">blockwise-operators</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#v_b_I">v_b_I</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.9" name="faq-27.9">faq-27.9</a><br>
27.9. How do I edit a header file with the same name as the corresponding C<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;source file?<br>
<br>
You can use the following command to edit a header file with the same name<br>
as the corresponding C source file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e %:t:r.h</div>
<br>
You can use the following command to edit the file in a new split window:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:sp %:t:r.h</div>
<br>
In the above commands, the percent sign expands to the name of the current<br>
file.&nbsp;&nbsp;The &quot;:t&quot; modifier extracts the tail (last component) of the<br>
filename. The &quot;:r&quot; modifier extracts the root of the filename.&nbsp;&nbsp;The .h is<br>
appended to the resulting name to get the header filename.<br>
<br>
Another approach is to use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:sfind %:t:r.h</div>
<br>
This command will search for the header file in the directories specified<br>
in the&nbsp;<a class="Type" href="options.html#'path'">'path'</a>&nbsp;option.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#cmdline-special">cmdline-special</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#filename-modifiers">filename-modifiers</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="windows.html#:sfind">:sfind</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'path'">'path'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-27.10" name="faq-27.10">faq-27.10</a><br>
27.10. How do I automatically insert comment leaders while typing comments?<br>
<br>
To automatically insert comment leaders while typing comments, add the 'r'<br>
and 'o' flags to the&nbsp;<a class="Type" href="options.html#'formatoptions'">'formatoptions'</a>&nbsp;option.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set formatoptions+=ro</div>
<br>
You may also want to add the 'c' flag to auto-wrap comments using the<br>
<a class="Type" href="options.html#'textwidth'">'textwidth'</a>&nbsp;option setting and the 'q' flag to format comments with the<br>
&quot;gq&quot; command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set formatoptions=croq</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_30.html#30.6">30.6</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#format-comments">format-comments</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'comments'">'comments'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#fo-table">fo-table</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-28" name="faq-28">faq-28</a><br>
SECTION 28 - QUICKFIX<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-28.1" name="faq-28.1">faq-28.1</a><br>
28.1. How do I build programs from Vim?<br>
<br>
You can use the &quot;:make&quot; command to build programs from Vim. The &quot;:make&quot;<br>
command runs the program specified by the&nbsp;<a class="Type" href="options.html#'makeprg'">'makeprg'</a>&nbsp;option.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_30.html#30.1">30.1</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:make_makeprg">:make_makeprg</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'makeprg'">'makeprg'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'makeef'">'makeef'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:make">:make</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#quickfix">quickfix</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-28.2" name="faq-28.2">faq-28.2</a><br>
28.2. When I run the make command in Vim I get the errors listed as the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;compiler compiles the program. When it finishes this list disappears<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and I have to use the&nbsp;&nbsp;:clist command to see the error message again.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is there any other way to see these error messages?<br>
<br>
You can use the &quot;:copen&quot; or &quot;:cwindow&quot; command to open the quickfix window<br>
that contains the compiler output. You can select different error lines<br>
from this window and jump to the corresponding line in the source code.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:copen">:copen</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:cwindow">:cwindow</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#quickfix">quickfix</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-28.3" name="faq-28.3">faq-28.3</a><br>
28.3. How can I perform a command for each item in the quickfix/location<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;list?<br>
<br>
Starting from Vim 7.4.858 Vim provides the new commands :cfdo, :cdo,<br>
:lfdo and :ldo. They work by iterating over all items in the quickfix<br>
list and performing a command on each. The difference is, that the :lfdo<br>
and :ldo commands iterate over the location list entries, while the<br>
:cfdo and :cdo commands operate on the items in the quickfix list. Also,<br>
the :cfdo and :lfdo operate on all different files, while the :cdo and<br>
:ldo commands operate on each item in the quickfix/location list.<br>
<br>
For example you could vimgrep all C files in the current directory for a<br>
search string &quot;Foobar&quot;:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:vimgrep /Foobar/ *.c</div>
<br>
and as this populates your quickfix list, you could simply replace all<br>
occurences by using:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:cdo :%s/Foobar/Foobaz | upd</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:cfdo">:cfdo</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="quickfix.html#:cdo">:cdo</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29" name="faq-29">faq-29</a><br>
SECTION 29 - FOLDING<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.1" name="faq-29.1">faq-29.1</a><br>
29.1. How do I extend the Vim folding support?<br>
<br>
You can use the&nbsp;<a class="Type" href="options.html#'foldexpr'">'foldexpr'</a>&nbsp;option to fold using a user specified function.<br>
For example, to fold subroutines of the following form into a single line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;sub foo {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my $barf;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$barf = 3;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return $barf;<br>
&nbsp;&nbsp;&nbsp;&nbsp;}</div>
<br>
You can use the following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;set foldmethod=expr<br>
&nbsp;&nbsp;&nbsp;&nbsp;set foldexpr=MyFoldExpr(v:lnum)<br>
&nbsp;&nbsp;&nbsp;&nbsp;fun! MyFoldExpr(line)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;let str = getline(a:line)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if str =~ '^sub\&gt;'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return '1'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif str =~ '^}'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return '&lt;1'<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return foldlevel(a:line - 1)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;endif<br>
&nbsp;&nbsp;&nbsp;&nbsp;endfun</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldexpr'">'foldexpr'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="fold.html#fold-expr">fold-expr</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.2" name="faq-29.2">faq-29.2</a><br>
29.2. When I enable folding by setting the&nbsp;<a class="Type" href="options.html#'foldmethod'">'foldmethod'</a>&nbsp;option, all the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;folds are closed. How do I prevent this?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'foldlevelstart'">'foldlevelstart'</a>&nbsp;option to a particular value to close only<br>
folds above the specified value.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set foldlevelstart=99</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldlevelstart'">'foldlevelstart'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldlevel'">'foldlevel'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="fold.html#fold-foldlevel">fold-foldlevel</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.3" name="faq-29.3">faq-29.3</a><br>
29.3. How do I control how many folds will be opened when I start editing a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;file?<br>
<br>
You can modify the&nbsp;<a class="Type" href="options.html#'foldlevelstart'">'foldlevelstart'</a>&nbsp;option to control the number of folds<br>
that will be opened when you start editing a file. To start editing with<br>
all the folds closed:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set foldlevelstart=0</div>
<br>
To start editing with all the folds opened, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set foldlevelstart=999</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldlevelstart'">'foldlevelstart'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.4" name="faq-29.4">faq-29.4</a><br>
29.4. How do I open and close folds using the mouse?<br>
<br>
You can click on the + and - characters displayed at the leftmost column to<br>
open and close fold. For this to work, you have to set the&nbsp;<a class="Type" href="options.html#'foldcolumn'">'foldcolumn'</a><br>
to a value greater than zero:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set foldcolumn=2</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldcolumn'">'foldcolumn'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.5" name="faq-29.5">faq-29.5</a><br>
29.5. How do I change the text displayed for a closed fold?<br>
<br>
You can use the&nbsp;<a class="Type" href="options.html#'foldtext'">'foldtext'</a>&nbsp;option to change the text displayed for a closed<br>
fold.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'foldtext'">'foldtext'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="fold.html#fold-foldtext">fold-foldtext</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fillchars'">'fillchars'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.6" name="faq-29.6">faq-29.6</a><br>
29.6. How do I store and restore manually created folds across different<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Vim invocations?<br>
<br>
You can use the &quot;:mkview&quot; command to store manually created folds. Later,<br>
you can use the &quot;:loadview&quot; command to restore the folds. For this to work,<br>
the&nbsp;<a class="Type" href="options.html#'viewoptions'">'viewoptions'</a>&nbsp;must contain &quot;folds&quot;.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_28.html#28.4">28.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:mkview">:mkview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:loadview">:loadview</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viewoptions'">'viewoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'viewdir'">'viewdir'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:mksession">:mksession</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'sessionoptions'">'sessionoptions'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-29.7" name="faq-29.7">faq-29.7</a><br>
29.7. I have enabled syntax based folding. Why is Vim so slow?<br>
<br>
Syntax based folding is currently rather slow in Vim and will possibly<br>
slow down Vim considerably. There is an issue in the todo list to fix<br>
this, but the todo list is rather long and it may take a while until<br>
this will be fixed.<br>
<br>
You can find the issue in the todo list, if you read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="todo.html">todo.txt</a><br>
<br>
followed by a search for &quot;folding with&nbsp;<a class="Type" href="options.html#'foldmethod'">'foldmethod'</a>&quot;<br>
<br>
A workaround is to temporarily set the foldmethod to manual while in<br>
insert mode. This is described in the wiki at:<br>
<span class="Constant"><a href="http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text">http://vim.wikia.com/wiki/Keep_folds_closed_while_inserting_text</a></span><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30" name="faq-30">faq-30</a><br>
SECTION 30 - VIM WITH EXTERNAL APPLICATIONS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.1" name="faq-30.1">faq-30.1</a><br>
30.1. Can I run a shell inside a Vim window?<br>
<br>
Currently Vim doesn't have support for running shell and other external<br>
commands inside a Vim window.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#shell-window">shell-window</a><br>
<br>
The Neovim project however has added the &quot;:terminal&quot; command which opens<br>
a new shell prompt. To read more about Neovim, look at their webpage<br>
<span class="Constant"><a href="http://neovim.io">http://neovim.io</a></span><br>
<br>
Alternatively, you can try using the Unix &quot;screen&quot;, &quot;tmux&quot; or &quot;splitvt&quot;<br>
utility.<br>
<br>
Following is a post from the vim_use mailinglist<br>
(<span class="Constant"><a href="http://groups.google.com/group/vim_use/msg/22c97ebfd6a978eb">http://groups.google.com/group/vim_use/msg/22c97ebfd6a978eb</a></span>)<br>
<br>
<span class="PreProc">-------------------------------------------</span><br>
Date: Mon, 24 May 2010<br>
Subject: Re: Terminal into vim, best options???<br>
From: Nico Raffo<br>
To: vim_use&nbsp;<br>
<br>
There are quite a few options out there, all with their strengths and<br>
weaknesses. Shell integration is at the top of the Vim wish list. I'm<br>
sure Bram would be more interested in including it if someone<br>
developed and maintained a kick-ass patch :-)<br>
<br>
Here is a (quite biased) overview of what's currently available:<br>
<br>
Conque Shell<br>
URL:&nbsp;<span class="Constant"><a href="http://code.google.com/p/conque/">http://code.google.com/p/conque/</a></span><br>
Author: Nico Raffo (me!)<br>
Requirements: *nix, python-enabled vim<br>
Type: Plugin<br>
<br>
Conque is a Vim plugin, written with Vim script and python. It turns<br>
your Vim buffer into a terminal emulator. In INSERT mode your buffer<br>
behaves like a standard unix terminal. In NORMAL mode you can navigate/<br>
search/page through the terminal output.<br>
<br>
Pros:<br>
&nbsp;* Relatively easy to install<br>
&nbsp;* Near complete VT100 support (you can run emacs in a vim buffer)<br>
&nbsp;* Use of Vim features in terminal, including syntax highlighting,<br>
&nbsp;&nbsp; copy/paste, etc<br>
&nbsp;* Active development<br>
<br>
Cons:<br>
&nbsp;* No Windows support (coming with Vim 7.3)<br>
&nbsp;* Can be slow, especially with programs which use a lot of terminal<br>
&nbsp;&nbsp; colors<br>
<br>
Vimshell<br>
URL:&nbsp;<span class="Constant"><a href="http://github.com/Shougo/vimshell">http://github.com/Shougo/vimshell</a></span>&nbsp;+&nbsp;<span class="Constant"><a href="http://github.com/Shougo/vimproc">http://github.com/Shougo/vimproc</a></span><br>
Author: Shougo M<br>
Requirements: Works on both *nix and Windows. One small, independent<br>
component may need to be compiled from C source.<br>
Type: Plugin<br>
<br>
Vimshell is a shell, written in the Vim scripting language, that runs<br>
in a Vim buffer. The shell was written to take full advantage of all<br>
of Vim's features, for example you can use Vim's omnicomplete<br>
features, or any other normal mode Vim commands, to edit your command<br>
line. Great potential, but missing a few features, particularly<br>
regarding interactive programs.<br>
<br>
Pros:<br>
&nbsp;* Relatively easy to install<br>
&nbsp;* Edit the command line with Vim, full use of Vim features in both<br>
&nbsp;&nbsp; normal and insert mode<br>
&nbsp;* Very fast, since there is no background process required<br>
&nbsp;* Windows support<br>
&nbsp;* Active development<br>
<br>
Cons:<br>
&nbsp;* Very limited support of interactive programs such as bash, mysql or<br>
&nbsp;&nbsp; python.<br>
&nbsp;* Shell has incomplete functionality compared to bash, etc.<br>
&nbsp;* Documentation only available in Japanese.<br>
<br>
<br>
screen.vim (Vim + screen/tmux)<br>
URL:&nbsp;<span class="Constant"><a href="http://www.vim.org/scripts/script.php?script_id=2711">http://www.vim.org/scripts/script.php?script_id=2711</a></span><br>
Author: Eric Van Dewoestine<br>
Requirements: *nix<br>
Type: Plugin<br>
<br>
screen.vim is a Vim plugin which streamlines and enhances the<br>
experience of running split screen terminal with Vim running in one of<br>
the windows and a terminal running in the other. It uses the programs<br>
screen or tmux to manage the split windows and to run the terminal<br>
emulation. Both of these programs are very mature, and will give a<br>
better terminal experience than any other option. However since the<br>
terminal is running independently of Vim, you won't be able to use Vim<br>
commands to interact with the terminal output.<br>
<br>
Pros:<br>
&nbsp;* Easy to install<br>
&nbsp;* Great shell support<br>
&nbsp;* Active development<br>
<br>
Cons:<br>
&nbsp;* No use of Vim commands to manage the shell window<br>
&nbsp;* Relatively little integration between Vim and the shell<br>
<br>
<br>
Vim-Shell<br>
URL:&nbsp;<span class="Constant"><a href="http://www.wana.at/vimshell/">http://www.wana.at/vimshell/</a></span><br>
Author: Thomas Wanda<br>
Requirements: *nix, patch and recompile Vim from source<br>
Type: Extension<br>
<br>
Vim-Shell is a Vim extension which converts a buffer into a terminal<br>
emulator. The shell window itself is very fast and functionality is<br>
very strong. It is works great for running complex interactive<br>
programs. However the Vim buffer where it runs is no longer editable<br>
(you can't scroll up, or even move the cursor). The last official<br>
release was for Vim 7.0, although time spent searching on Google will<br>
turn up patches for Vim 7.1 and 7.2.<br>
<br>
Pros:<br>
&nbsp;* Near complete VT100 support (you can run emacs in a vim buffer, and<br>
&nbsp;&nbsp; just about anything else)<br>
&nbsp;* Very fast. Compiled into the C source<br>
<br>
Cons:<br>
&nbsp;* Relatively difficult to install<br>
&nbsp;* No use of Vim features to navigate terminal output<br>
&nbsp;* No Windows or Mac support.<br>
&nbsp;* No development activity since 2006<br>
<br>
<br>
Vimsh<br>
URL:&nbsp;<span class="Constant"><a href="http://www.vim.org/scripts/script.php?script_id=165">http://www.vim.org/scripts/script.php?script_id=165</a></span><br>
Author: Brian Sturk<br>
Requirements: python-enabled vim<br>
Type: Plugin<br>
<br>
Vimsh is a Vim plugin which allows you to run interactive programs in<br>
a vim buffer. It provides a nice option for Windows use, but<br>
functionality is overall less mature than the other options.<br>
<br>
Pros:<br>
&nbsp;* Relatively easy to install<br>
&nbsp;* Use Vim commands to edit commands and navigate terminal output<br>
&nbsp;* Support in both *nix and Windows (no interactive programs in<br>
&nbsp;&nbsp; Windows)<br>
<br>
Cons:<br>
&nbsp;* Limited functionality<br>
&nbsp;* Inactive development<br>
<br>
<span class="PreProc">-------------------------------------------</span><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.2" name="faq-30.2">faq-30.2</a><br>
30.2. How do I pass the word under the cursor to an external command?<br>
<br>
You can use the special keyword&nbsp;<span class="Special">&lt;cword&gt;</span>&nbsp;to pass the word under the cursor<br>
to an external command. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:!dict &lt;cword&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="cmdline.html#:<cword>">:&lt;cword&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.3" name="faq-30.3">faq-30.3</a><br>
30.3. How do I get the output of a shell command into a Vim buffer?<br>
<br>
You can use the &quot;:r !&quot; command to get the output of a shell command into a<br>
Vim buffer. For example, to insert the output of the &quot;ls&quot; shell command,<br>
you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:r !ls</div>
<br>
To insert the output of the shell command above the first line use the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:0r !ls</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#:r!">:r!</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.4" name="faq-30.4">faq-30.4</a><br>
30.4. How do I pipe the contents of the current buffer to an external<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command and replace the contents of the buffer with the output from<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the command?<br>
<br>
You can use the :! command to pipe the contents of the current buffer to an<br>
external command and replace the contents of the buffer with the output<br>
from the command. For example, to sort the contents of the current buffer,<br>
using the Unix sort command, you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:%!sort</div>
<br>
To sort only lines 10-20, you can use the following command<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:10,20!sort</div>
<br>
Also, if you want to pipe a buffer to an external command but not put the<br>
results back in the buffer, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:w !sort</div>
<br>
The above command will pipe the entire buffer to the sort command.&nbsp;&nbsp;<span class="Todo">Note</span>,<br>
that the space between the 'w' and the '!' is critical.&nbsp;&nbsp;To pipe only a<br>
range of lines, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:10,20w !sort</div>
<br>
The above command will pipe the lines 10-20 to the sort command.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:range!">:range!</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.9">10.9</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#:w_c">:w_c</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.5" name="faq-30.5">faq-30.5</a><br>
30.5. How do I sort a section of my file?<br>
<br>
You use the &quot;:sort&quot; command like this:<br>
<br>
&nbsp;&nbsp; :5,100sort<br>
<br>
Using the &quot;:sort&quot; command provides many options, you can sort numerical on<br>
the first found decimal number using:<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp; :%sort n<br>
<br>
Or you can specify to sort on the text, starting at virtual column 8:<br>
<br>
&nbsp;&nbsp; :%sort /.*\%8v/<br>
<br>
Alternatively can pipe a section of the file to the Unix &quot;sort&quot; utility to<br>
sort the file. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:5,100!sort</div>
<br>
You can also use a visual block, and use the &quot;!sort&quot; command on the<br>
selected block.<br>
<br>
See also:<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#:sort">:sort</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="change.html#filter">filter</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.6" name="faq-30.6">faq-30.6</a><br>
30.6. How do I use Vim as a pager?<br>
<br>
You can use Vim as a pager using the $VIMRUNTIME/macros/less.sh shell<br>
script, supplied as part of the standard Vim distribution. This shell<br>
script uses the $VIMRUNTIME/macros/less.vim Vim script to provide less like<br>
key bindings.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#less">less</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.7" name="faq-30.7">faq-30.7</a><br>
30.7. How do I view Unix man pages from inside Vim?<br>
<br>
You can view Unix man pages, inside Vim, using the man.vim plugin supplied<br>
as part of the standard Vim distribution. To use this plugin, add the<br>
following line to your startup vimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;runtime ftplugin/man.vim</div>
<br>
You can also press the K key to run the program specified by the<br>
<a class="Type" href="options.html#'keywordprg'">'keywordprg'</a>&nbsp;option with the keyword under the cursor. By default,<br>
<a class="Type" href="options.html#'keywordprg'">'keywordprg'</a>&nbsp;is set to run man on the keyword under the cursor.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#ft-man-plugin">ft-man-plugin</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#K">K</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'keywordprg'">'keywordprg'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.8" name="faq-30.8">faq-30.8</a><br>
30.8. How do I change the diff command used by the Vim diff support?<br>
<br>
By default, the Vim diff support uses the&nbsp;<a class="Type" href="options.html#'diff'">'diff'</a>&nbsp;command. You can change<br>
this by changing the&nbsp;<a class="Type" href="options.html#'diffexpr'">'diffexpr'</a>&nbsp;option.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="diff.html#diff-diffexpr">diff-diffexpr</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'diffexpr'">'diffexpr'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-30.9" name="faq-30.9">faq-30.9</a><br>
30.9. How do I use the Vim diff mode without folding?<br>
<br>
You can use the following command-line to start Vim with two filenames<br>
and use the diff mode without folding:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -o file1 file2 &quot;+windo set diff scrollbind scrollopt+=hor nowrap&quot;</div>
<br>
If you like vertically split windows, then replace &quot;-o&quot; with &quot;-O&quot;.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="diff.html#vimdiff">vimdiff</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31" name="faq-31">faq-31</a><br>
SECTION 31 - GUI VIM<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.1" name="faq-31.1">faq-31.1</a><br>
31.1. How do I create buffer specific menus?<br>
<br>
Adding support for buffer specific menus is in the Vim TODO list. In the<br>
mean time, you can try Michael Geddes's plugin, buffermenu.vim:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vim.sourceforge.net/scripts/script.php?script_id=246">http://vim.sourceforge.net/scripts/script.php?script_id=246</a></div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.2" name="faq-31.2">faq-31.2</a><br>
31.2. How do I change the font used by GUI Vim?<br>
<br>
You can change the&nbsp;<a class="Type" href="options.html#'guifont'">'guifont'</a>&nbsp;option to change the font used by GUI Vim.&nbsp;&nbsp;To<br>
display the current value of this option, you can use<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guifont?</div>
<br>
You can add the displayed font name to the .vimrc file to use the font<br>
across Vim sessions. For example, add the following line to the .vimrc file<br>
to use Andale Mono font.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;set guifont=Andale_Mono:h10:cANSI</div>
<br>
For Win32, GTK and Photon version of Vim, you can use the following command<br>
to bringup a dialog which will help you in changing the guifont:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guifont=*</div>
<br>
You can also use the -font Vim command line option to specify the font used<br>
for normal text.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guifont'">'guifont'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guifontset'">'guifontset'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guifontwide'">'guifontwide'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#font-sizes">font-sizes</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-font">-font</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-boldfont">-boldfont</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-italicfont">-italicfont</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-menufont">-menufont</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-menufontset">-menufontset</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.3" name="faq-31.3">faq-31.3</a><br>
31.3. When starting GUI Vim, how do I specify the location of the GVIM<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window?<br>
<br>
You can use the &quot;-geometry&quot; command line argument to specify the location<br>
of the GUI Vim window. For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ gvim -geometry 80x25+100+300</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_31.html#31.4">31.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#-geom">-geom</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.4" name="faq-31.4">faq-31.4</a><br>
31.4. How do I add a horizontal scrollbar in GVim?<br>
<br>
You can enable the horizontal scrollbar by modifying the&nbsp;<a class="Type" href="options.html#'guioptions'">'guioptions'</a><br>
option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions+=b</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guioptions'">'guioptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#gui-horiz-scroll">gui-horiz-scroll</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.5" name="faq-31.5">faq-31.5</a><br>
31.5. How do I make the scrollbar appear in the left side by default?<br>
<br>
You can add the 'l' flag to the&nbsp;<a class="Type" href="options.html#'guioptions'">'guioptions'</a>&nbsp;option to make the scrollbar<br>
appear in the left side.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions+=l<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions-=r</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guioptions'">'guioptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#gui-scrollbars">gui-scrollbars</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.6" name="faq-31.6">faq-31.6</a><br>
31.6. How do I remove the Vim menubar?<br>
<br>
You can remove the Vim menubar by removing the 'm' flag from the<br>
<a class="Type" href="options.html#'guioptions'">'guioptions'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions-=m</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guioptions'">'guioptions'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.7" name="faq-31.7">faq-31.7</a><br>
31.7. I am using GUI Vim. When I press the ALT key and a letter, the menu<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;starting with that letter is selected. I don't want this behavior as<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I want to map the ALT-<span class="Special">&lt;key&gt;</span>&nbsp;combination. How do I do this?<br>
<br>
You can use the&nbsp;<a class="Type" href="options.html#'winaltkeys'">'winaltkeys'</a>&nbsp;option to disable the use of the ALT key to<br>
select a menu item:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set winaltkeys=no</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'winaltkeys'">'winaltkeys'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#:simalt">:simalt</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.8" name="faq-31.8">faq-31.8</a><br>
31.8. Is it possible to scroll the text by dragging the scrollbar so that<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the cursor stays in the original location?<br>
<br>
The way Vim is designed, the cursor position has to be in a visible spot in<br>
normal, visual, select and insert mode. This cannot be changed without<br>
modifying Vim. When the scrollbar is used, the cursor will be moved so that<br>
it is always visible. Another approach to solving this problem is to use<br>
the Vim marks. You can mark the current cursor position using ma. Then<br>
scroll to a different part of the text and jump back to the old position<br>
using `a. You can also try the following suggestion from the Vim Online<br>
website:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://vim.wikia.com/wiki/VimTip320">http://vim.wikia.com/wiki/VimTip320</a></div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#mark-motions">mark-motions</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.9" name="faq-31.9">faq-31.9</a><br>
31.9. How do I get gvim to start browsing files in a particular directory<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;when using the &quot;:browse&quot; command?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'browsedir'">'browsedir'</a>&nbsp;option to the default directory to use for the<br>
&quot;:browse&quot; command.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set browsedir='&lt;your_dir&gt;'</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'browsedir'">'browsedir'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.10" name="faq-31.10">faq-31.10</a><br>
31.10. For some questions, like when a file is changed outside of Vim, Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displays a GUI dialog box. How do I replace this GUI dialog box with<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; a console dialog box?<br>
<br>
You can set the 'c' flag in the&nbsp;<a class="Type" href="options.html#'guioptions'">'guioptions'</a>&nbsp;option to configure Vim to use<br>
console dialogs instead of GUI dialogs:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions+=c</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guioptions'">'guioptions'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.11" name="faq-31.11">faq-31.11</a><br>
31.11. I am trying to use GUI Vim as the editor for my xxx application.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When the xxx application launches GUI Vim to edit a file, the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; control immediately returns to the xxx application. How do I start<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GUI Vim, so that the control returns to the xxx application only<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; after I quit Vim?<br>
<br>
You have to start GUI Vim with the '-f' (foreground) command line option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ gvim -f</div>
<br>
By default, GUI Vim will disconnect from the program that started Vim. With<br>
the '-f' option, GUI Vim will not disconnect from the program that started<br>
it.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#gui-fork">gui-fork</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-f">-f</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.12" name="faq-31.12">faq-31.12</a><br>
31.12. Why does the &quot;Select Font&quot; dialog doesn't show all the fonts<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; installed in my system?<br>
<br>
Vim supports only fixed width (mono-spaced) fonts. Proportional fonts are<br>
not supported.&nbsp;&nbsp;In the &quot;Select Font&quot; dialog, only fixed width fonts will be<br>
displayed.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#font-sizes">font-sizes</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guifont'">'guifont'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.13" name="faq-31.13">faq-31.13</a><br>
31.13. How do I use the mouse in Vim command-line mode?<br>
<br>
You can set the 'c' flag in the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option to use mouse in the Vim<br>
command-line mode:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set mouse+=c</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#mouse-using">mouse-using</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#gui-mouse">gui-mouse</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_09.html#09.2">09.2</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.14" name="faq-31.14">faq-31.14</a><br>
31.14. When I use the middle mouse button to scroll text, it pastes the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; last copied text. How do I disable this behavior?<br>
<br>
You can map the middle mouse button to&nbsp;<span class="Special">&lt;Nop&gt;</span>&nbsp;to disable the middle mouse<br>
button:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map&nbsp;&nbsp;&lt;MiddleMouse&gt; &lt;Nop&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:map! &lt;MiddleMouse&gt; &lt;Nop&gt;</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#gui-mouse-mapping">gui-mouse-mapping</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="map.html#<Nop>">&lt;Nop&gt;</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.15" name="faq-31.15">faq-31.15</a><br>
31.15. How do I change the location and size of a GUI Vim window?<br>
<br>
You can use the &quot;winpos&quot; command to change the Vim window position. To<br>
change the size of the window, you can modify the &quot;lines&quot; and &quot;columns&quot;<br>
options.<br>
<br>
For example, the following commands will position the GUI Vim window at the<br>
X,Y co-ordinates 50,50 and set the number of lines to 50 and the number of<br>
columns to 80.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:winpos 50 50<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set lines=50<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set columns=80</div>
<br>
The arguments to the&nbsp;<span class="MissingTag">'winpos'</span>&nbsp;command specify the pixel co-ordinates of the<br>
Vim window. The&nbsp;<a class="Type" href="options.html#'lines'">'lines'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'columns'">'columns'</a>&nbsp;options specify the number of lines<br>
and characters to use for the height and the width of the window<br>
respectively.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_31.html#31.4">31.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#:winpos">:winpos</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'lines'">'lines'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'columns'">'columns'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#GUIEnter">GUIEnter</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-31.16" name="faq-31.16">faq-31.16</a><br>
31.16. When splitting the Vim window vertically, Vim changes the position.<br>
<br>
This is a known problem. When you are splitting the Vim window, Vim will<br>
try to draw a scrollbar. Since this changes the gui window, Vim tries to<br>
resize its main window to keep the same position and this will cause Vim<br>
to move its position. This happens on Windows with a multi-window setup or<br>
a window that was &quot;snapped&quot; to a certain position.&nbsp;<br>
<br>
A workaournd to this problem is, to remove gui scrollbars, e.g.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guioptions-=L</div>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32" name="faq-32">faq-32</a><br>
SECTION 32 - VIM ON UNIX<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.1" name="faq-32.1">faq-32.1</a><br>
32.1. I am running Vim in a xterm. When I press the&nbsp;<span class="Special">CTRL-S</span>&nbsp;key, Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;freezes. What should I do now?<br>
<br>
Many terminal emulators and real terminal drivers use the&nbsp;<span class="Special">CTRL-S</span>&nbsp;key to<br>
stop the data from arriving so that you can stop a fast scrolling display<br>
to look at it (also allowed older terminals to slow down the computer so<br>
that it did not get buffer overflows).&nbsp;&nbsp;You can start the output again by<br>
pressing the&nbsp;<span class="Special">CTRL-Q</span>&nbsp;key.<br>
<br>
When you press the&nbsp;<span class="Special">CTRL-S</span>&nbsp;key, the terminal driver will stop sending the<br>
output data. As a result of this, it will look like Vim is hung. If you<br>
press the&nbsp;<span class="Special">CTRL-Q</span>&nbsp;key, then everything will be back to normal.<br>
<br>
You can turn off the terminal driver flow control using the&nbsp;<span class="MissingTag">'stty'</span>&nbsp;command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ stty -ixon -ixoff</div>
<br>
or, you can change the keys used for the terminal flow control, using the<br>
following commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ stty stop &lt;char&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;$ stty start &lt;char&gt;</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.2" name="faq-32.2">faq-32.2</a><br>
32.2. I am seeing weird screen update problems in Vim. What can I do to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;solve this screen/display update problems?<br>
<br>
You have to use a proper terminal emulator like xterm with correct TERM<br>
settings (TERM=xterm) and a correct terminfo/termcap file.<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'term'">'term'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.3" name="faq-32.3">faq-32.3</a><br>
32.3. I am using the terminal/console version of Vim. In insertmode, When I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;press the backspace key, the character before the cursor is not<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;erased. How do I configure Vim to do this?<br>
<br>
You have to make sure that Vim gets the correct keycode for the backpspace<br>
key. You can try using the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:fixdel</div>
<br>
Make sure the TERM environment variable is set to the correct terminal<br>
name. You can try using the&nbsp;<span class="MissingTag">'stty'</span>&nbsp;command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ stty erase ^H</div>
<br>
where, you have to enter the ^H character by pressing the&nbsp;<span class="Special">CTRL-V</span>&nbsp;key and<br>
then the&nbsp;<span class="Special">CTRL-H</span>&nbsp;key. Also check the value of your&nbsp;<a class="Type" href="options.html#'backspace'">'backspace'</a>&nbsp;setting.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#:fixdel">:fixdel</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#Linux-backspace">Linux-backspace</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#NetBSD-backspace">NetBSD-backspace</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'backspace'">'backspace'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.4" name="faq-32.4">faq-32.4</a><br>
32.4. I am using Vim in a xterm. When I quit Vim, the screen contents are<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;restored back to the original contents. How do I disable this?<br>
<br>
The xterm has a capability called &quot;alternate screen&quot;.&nbsp;&nbsp;If this capability<br>
is present, vim switches to that alternate screen upon startup and back on<br>
exit, thus restoring the original screen contents.&nbsp;&nbsp;To disable this<br>
feature, add the following line to your .vimrc file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set t_ti= t_te=</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'restorescreen'">'restorescreen'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#xterm-screens">xterm-screens</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.5" name="faq-32.5">faq-32.5</a><br>
32.5. When I start Vim, it takes quite a few seconds to start. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;minimize the startup time?<br>
<br>
This may be related to Vim opening the X display for setting the xterm<br>
title and using the X clipboard. Make sure the DISPLAY variable is set to<br>
point to the correct host. Try using the command line:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -X</div>
<br>
This will prevent Vim from opening the X display. With this command-line<br>
option, the X clipboard cannot be used and also Vim will not be able to<br>
change the xterm title.<br>
<br>
You can also set the&nbsp;<a class="Type" href="options.html#'clipboard'">'clipboard'</a>&nbsp;option to<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set clipboard=exclude:.*</div>
<br>
This has the same effect as using the -X command-line argument.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-X">-X</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'clipboard'">'clipboard'</a><br>
<br>
If the clipboard is not the cause of the slow startup, it might be a<br>
plugin that slows down Vim. In that case, you can use the --startuptime<br>
argument to debug this further. You can do:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim --startuptime vim_startup.log</div>
<br>
and the timing will be written to the file vim_startup.log. For even<br>
more advanced profiling, you can use the profiling feature, that is<br>
available in huge builds of Vim. To do so, call Vim like this:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim --cmd 'profile start profile.log' \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--cmd 'profile func *' \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--cmd 'profile file *' \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-c 'profdel func *' \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-c 'profdel file *' \<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-c 'qa!'</div>
<br>
After running this, you will have a file profile.log in your current<br>
directory. To further analyse this, open the file profile.log and run:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&quot; Open profile.log file in vim first<br>
&nbsp;&nbsp;&nbsp;&nbsp;:let timings=[]<br>
&nbsp;&nbsp;&nbsp;&nbsp;:g/^SCRIPT/call add(timings, [getline('.')[len('SCRIPT&nbsp;&nbsp;'):], matchstr(getline(line('.')+1), '^Sourced \zs\d\+')]+map(getline(line('.')+2, line('.')+3), 'matchstr(v:val, ''\d\+\.\d\+$'')'))<br>
&nbsp;&nbsp;&nbsp;&nbsp;:enew<br>
&nbsp;&nbsp;&nbsp;&nbsp;:call setline('.', ['count total (s)&nbsp;&nbsp; self (s)&nbsp;&nbsp;script']+map(copy(timings), 'printf(&quot;%5u %9s&nbsp;&nbsp; %8s&nbsp;&nbsp;%s&quot;, v:val[1], v:val[2], v:val[3], v:val[0])'))</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#--startuptime">--startuptime</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="repeat.html#profiling">profiling</a><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.6" name="faq-32.6">faq-32.6</a><br>
32.6. How can I make the cursor in gvim in unix stop blinking?<br>
<br>
You can modify the&nbsp;<a class="Type" href="options.html#'guicursor'">'guicursor'</a>&nbsp;option, to stop the cursor from blinking.<br>
For example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set guicursor=a:blinkon0</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'guicursor'">'guicursor'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.7" name="faq-32.7">faq-32.7</a><br>
32.7. How do I change the menu font on GTK Vim?<br>
<br>
You can modify the ~/.gtkrc file to change the menu font on GTK Vim. For<br>
example:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;style &quot;default&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;{ font =&quot;smooth09&quot; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;class &quot;*&quot; style &quot;default&quot;</div>
<br>
The last line changes the font of all widgets.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#gui-gtk">gui-gtk</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.8" name="faq-32.8">faq-32.8</a><br>
32.8. How do I prevent&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;from suspending Vim?<br>
<br>
You can map&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;to prevent the suspending. Here are some suggestions:<br>
<br>
- Make&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;do nothing:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;C-Z&gt; &lt;Nop&gt;</div>
<br>
- Make&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;start a shell:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;C-Z&gt; :shell&lt;CR&gt;</div>
<br>
- Make&nbsp;<span class="Special">&lt;Ctrl-Z&gt;</span>&nbsp;give an error message:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:map &lt;C-Z&gt; :&quot;suspending disabled&lt;CR&gt;</div>
<br>
For the last example, the double quote is necessary in order to keep the<br>
message on the status line.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.9" name="faq-32.9">faq-32.9</a><br>
32.9. When I kill the xterm running Vim, the Vim process continues to run<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;and takes up a lot of CPU (99%) time. Why is this happening?<br>
<br>
When Vim is built with support for Python interface, you will have this<br>
problem. This is a known problem with the python thread library and Vim.&nbsp;&nbsp;To<br>
solve this problem, use a Vim binary built without the Python interface.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#+python">+python</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="if_pyth.html#python">python</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-32.10" name="faq-32.10">faq-32.10</a><br>
32.10. How do I get the Vim syntax highlighting to work in a Unix terminal?<br>
<br>
The easiest and simplest way to get Vim syntax highlighting is to use the<br>
GUI version of Vim (GVIM). To get syntax highlighting to work in the<br>
console/terminal version of Vim, you have to run a terminal emulator (like<br>
Xfree86 xterm or rxvt or dtterm) that supports color.&nbsp;<span class="Todo">Note</span>&nbsp;that if a<br>
terminal emulator supports changing the background and foreground colors,<br>
that does not mean that it also supports ANSI escape sequences for changing<br>
the color. You can download the latest version of Xfree86 xterm from<br>
<span class="Constant"><a href="http://dickey.his.com/xterm/xterm.html">http://dickey.his.com/xterm/xterm.html</a></span>. You can download the latest version<br>
of rxvt from&nbsp;<span class="Constant"><a href="http://www.rxvt.org">http://www.rxvt.org</a></span>. You have to install the terminfo/termcap<br>
file that supports colors for the terminal emulator. Also, set the TERM<br>
environment variable to the correct name of the term that supports colors.<br>
<br>
You can use the colortest.vim script supplied with the Vim runtime<br>
package to test the color setup. To use this script, follow these steps:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:e $VIMRUNTIME/syntax/colortest.vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;:source %</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_06.html#06.2">06.2</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="os_unix.html#terminal-colors">terminal-colors</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#termcap-colors">termcap-colors</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#startup-terminal">startup-terminal</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#xterm-color">xterm-color</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#colortest.vim">colortest.vim</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33" name="faq-33">faq-33</a><br>
SECTION 33 - VIM ON MS-WINDOWS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.1" name="faq-33.1">faq-33.1</a><br>
33.1. In MS-Windows,&nbsp;<span class="Special">CTRL-V</span>&nbsp;doesn't start the blockwise visual mode. What<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;happened?<br>
<br>
The mswin.vim script provides key mappings and options to make Vim behave<br>
like a MS-Windows application. One of the keys mapped is&nbsp;<span class="Special">CTRL-V</span>&nbsp;which is<br>
used for pasting text in MS-Windows applications. This will disable the use<br>
of&nbsp;<span class="Special">CTRL-V</span>&nbsp;to start the blockwise visual mode. The mswin.vim script maps<br>
<span class="Special">CTRL-Q</span>&nbsp;for staring the blockwise visual mode. So you can use&nbsp;<span class="Special">CTRL-Q</span>&nbsp;instead<br>
of&nbsp;<span class="Special">CTRL-V</span>.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="visual.html#CTRL-V">CTRL-V</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#CTRL-V-alternative">CTRL-V-alternative</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#CTRL-Q">CTRL-Q</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_10.html#10.5">10.5</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.2" name="faq-33.2">faq-33.2</a><br>
33.2. When I press the&nbsp;<span class="Special">CTRL-Y</span>&nbsp;key, it acts like the&nbsp;<span class="Special">CTRL-R</span>&nbsp;key. How do I<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;configure Vim to treat&nbsp;<span class="Special">CTRL-Y</span>&nbsp;as&nbsp;<span class="Special">CTRL-Y</span>?<br>
<br>
The mapping of the&nbsp;<span class="Special">CTRL-Y</span>&nbsp;key to the&nbsp;<span class="Special">CTRL-R</span>&nbsp;key is done by the mswin.vim<br>
script. The mswin.vim script maps&nbsp;<span class="Special">CTRL-Y</span>&nbsp;to make Vim behave like a standard<br>
MS-Windows application. This is explained in &quot;:help&nbsp;<span class="Special">CTRL-Y</span>&quot;. You can either<br>
comment out the line in mswin.vim that maps the&nbsp;<span class="Special">CTRL-Y</span>&nbsp;key or you can<br>
remove the line in your .vimrc file that sources the mswin.vim script.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.3" name="faq-33.3">faq-33.3</a><br>
33.3. How do I start GUI Vim in a maximized window always?<br>
<br>
You can use the &quot;simalt&quot; command to maximize the Vim window. You can use<br>
the GUIEnter autocmd to maximize the Vim window on startup:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;autocmd GUIEnter * simalt ~x</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#:simalt">:simalt</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="autocmd.html#GUIEnter">GUIEnter</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#gui-win32-maximized">gui-win32-maximized</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.4" name="faq-33.4">faq-33.4</a><br>
33.4. After doing some editing operations, Vim freezes. The cursor becomes<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;an empty rectangle. I am not able enter any characters. What is<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;happening?<br>
<br>
Most probably, you used the mouse wheel to scroll the text in Vim. There is<br>
a known problem in using intellimouse mouse wheel with Vim. To avoid this<br>
problem, disable Universal scrolling support for Vim.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_w32.html#intellimouse-wheel-problems">intellimouse-wheel-problems</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.5" name="faq-33.5">faq-33.5</a><br>
33.5. I am using Windows XP, the display speed of maximized GVim is very<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;slow. What can I do to speed the display updates?<br>
<br>
This may be due to the fact that you have enabled 'Smooth edges of screen<br>
fonts' in the display properties. Try turning off font smoothing or try<br>
changing the smoothing method to &quot;Standard&quot;.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.6" name="faq-33.6">faq-33.6</a><br>
33.6. What are the recommended settings for using Vim with cygwin?<br>
<br>
You may want to set the following shell related Vim settings:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set shellcmdflag=-c<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shellquote=<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shellslash&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; Use the forward slash for expansion.<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shellxquote=\&quot;<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shell=d:\cygwin\bin\bash.exe &quot; Use the bash shell<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shellpipe=2&gt;&amp;1| tee<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set shellredir=&gt;%s 2&gt;&amp;1</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.7" name="faq-33.7">faq-33.7</a><br>
33.7. I am trying to use GNU diff with Vim diff mode. When I run the diff<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;from command line, it works. When I try to use the diff with Vim it<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;doesn't work. What should I do now?<br>
<br>
There is a problem with using GNU diff with Vim. You can try using the<br>
GNU diff.exe built by Ron Aaron from the following link:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.mossbayeng.com/~ron/vim/builds.html">http://www.mossbayeng.com/~ron/vim/builds.html</a></div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.8" name="faq-33.8">faq-33.8</a><br>
33.8. Is it possible to use Vim as an external editor for MS-Windows<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Outlook email client?<br>
<br>
You can use the &quot;cubiclevim&quot; COM Add-In to use Vim as an external editor<br>
for MS-Windows Outlook email client. Visit the following URL for more<br>
information:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://sourceforge.net/projects/cubiclevim">http://sourceforge.net/projects/cubiclevim</a></div>
<br>
<span class="Todo">Note</span>, that currently this works only with MS-Office 2000 and XP.<br>
<br>
Also the plugin OutlookVim might be worth a look:<br>
<br>
<span class="Constant"><a href="http://www.vim.org/scripts/script.php?script_id=3087">http://www.vim.org/scripts/script.php?script_id=3087</a></span><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.9" name="faq-33.9">faq-33.9</a><br>
33.9. I am using Vim to edit HTML files. How do I start internet explorer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with the current file to preview the HTML file?<br>
<br>
You can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:!start c:\progra~1\intern~1\iexplore.exe file://%:p&lt;CR&gt;</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.10" name="faq-33.10">faq-33.10</a><br>
33.10. I would like to use Vim with Microsoft Visual Studio. How do I do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this?<br>
<br>
You have to download and use the OLE version of Vim (for example:<br>
gvim61ole.zip). This file also contains instructions on how to use Vim with<br>
Visual Studio.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="if_ole.html#MSVisualStudio">MSVisualStudio</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.11" name="faq-33.11">faq-33.11</a><br>
33.11. Where do I place the _vimrc and _gvimrc files?<br>
<br>
You can place the _vimrc and _gvimrc files under the directory pointed to<br>
by the VIM environment variable. If you are sharing this system with other<br>
users, then you can place the files in a directory and set the HOME<br>
environment variable to this directory.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version5.html#$HOME-use">$HOME-use</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#_vimrc">_vimrc</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-33.12" name="faq-33.12">faq-33.12</a><br>
33.12. Every time I save a file, Vim warns about the file being changed<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; outside of Vim. Why?<br>
<br>
If you get the following warning message, every time you save a file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;WARNING: The file has been changed since reading it!!!<br>
&nbsp;&nbsp;&nbsp;&nbsp;Do you really want to write to it (y/n)?</div>
<br>
then this problem could be related to a bug in MS-Windows on the day<br>
daylight saving time starts.&nbsp;&nbsp;Vim remembers the timestamp of the file after<br>
it was written.&nbsp;&nbsp;Just before the next write the timestamp is obtained again<br>
to check if the file was changed outside of Vim.&nbsp;&nbsp;This works correctly,<br>
except on the day daylight saving time starts.<br>
<br>
This problem will go away the next day after the day the daylight saving<br>
time starts.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#W11">W11</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-34" name="faq-34">faq-34</a><br>
SECTION 34 - PRINTING<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-34.1" name="faq-34.1">faq-34.1</a><br>
34.1. How do I print a file along with line numbers for all the lines?<br>
<br>
You can set the&nbsp;<a class="Type" href="options.html#'printoptions'">'printoptions'</a>&nbsp;option and use the &quot;:hardcopy&quot; command to<br>
print your file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set printoptions=number:y<br>
&nbsp;&nbsp;&nbsp;&nbsp;:hardcopy</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'printoptions'">'printoptions'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="print.html#:hardcopy">:hardcopy</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-34.2" name="faq-34.2">faq-34.2</a><br>
34.2. How do I print a file with the Vim syntax highlighting colors?<br>
<br>
You can use the &quot;:hardcopy&quot; command to print a file with the Vim syntax<br>
highlighting colors. You can also convert your file to a HTML file using<br>
the 2html.vim script and print the HTML file.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_06.html#syntax-printing">syntax-printing</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="syntax.html#2html.vim">2html.vim</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="print.html#:hardcopy">:hardcopy</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="print.html#printing">printing</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35" name="faq-35">faq-35</a><br>
SECTION 35 - BUILDING VIM FROM SOURCE<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.1" name="faq-35.1">faq-35.1</a><br>
35.1. How do I build Vim from the sources on a Unix system?<br>
<br>
For a Unix system, follow these steps to build Vim from the sources:<br>
<br>
- Download the source and run-time files archive (vim-##.tar.bz2) from the<br>
&nbsp;&nbsp;<span class="Constant">ftp://ftp.vim.org/pub/vim/unix</span>&nbsp;directory.<br>
- Extract the archive using the bzip2 and tar utilities using the command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$ bunzip2 -c &lt;filename&gt; | tar -xf -</div>
<br>
- Alternatively, download the source from the mercurial repository:<br>
&nbsp;&nbsp;<span class="Constant"><a href="http://code.google.com/p/vim/source/checkout">http://code.google.com/p/vim/source/checkout</a></span><br>
- Run the&nbsp;<span class="MissingTag">'make'</span>&nbsp;command to configure and build Vim with the default<br>
&nbsp;&nbsp;configuration.<br>
- Run 'make install' command to install Vim in the default directory.<br>
<br>
To enable/disable various Vim features, before running the&nbsp;<span class="MissingTag">'make'</span>&nbsp;command<br>
you can run the&nbsp;<span class="MissingTag">'configure'</span>&nbsp;command with different flags to include/exclude<br>
the various Vim features. To list all the available options for the<br>
<span class="MissingTag">'configure'</span>&nbsp;command, use:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ configure -help</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install">install</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.2" name="faq-35.2">faq-35.2</a><br>
35.2. How do I install Vim in my home directory or a directory other<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;than the default installation directory in Unix?<br>
<br>
To install Vim in a directory other than the default installation<br>
directory, you have to specify the directory using the --prefix option<br>
while running the configure script.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ ./configure --prefix=/users/xyz</div>
<br>
You can enable/disable various Vim feature by supplying different arguments<br>
to the configure script. For more information about all these options, run<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ ./configure --help</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install-home">install-home</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install">install</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.3" name="faq-35.3">faq-35.3</a><br>
35.3. How do I build Vim from the sources on a MS-Windows system?<br>
<br>
For a MS-Windows system, Vim can be built using either the Visual C++<br>
compiler or the Borland C++ compiler or the Ming GCC compiler or the cygwin<br>
gcc compiler. Follow these steps to build Vim from the sources for<br>
MS-Windows:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;- Download the source (vim##src.zip), runtime (vim##rt.zip) and the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;extra (vim-##-extra.tar.gz) archives from the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ftp://ftp.vim.org/pub/vim/pc directory.<br>
&nbsp;&nbsp;&nbsp;&nbsp;- Extract the archives into a directory (for example, c:\vimsrc)<br>
&nbsp;&nbsp;&nbsp;&nbsp;- Alternatively, download the source from the mercurial repository:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://code.google.com/p/vim/source/checkout">http://code.google.com/p/vim/source/checkout</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;- Depending on the installed compiler, you can use the corresponding<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;makefile to build the Vim sources. For Visual C++ use the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Make_mvc.mak makefile, for borland C++ use the Make_bc5.mak makefile,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for ming GCC use the Make_ming.mak makefile, for cygwin gcc use the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Make_cyg.mak makefile.</div>
<br>
Depending on whether you want to build the GUI version of Vim or the<br>
console version of Vim, you have to pass different arguments to the<br>
makefiles. After successfully building the sources, you can copy the<br>
vim.exe or gvim.exe file to the desired directory along with the files from<br>
the runtime archive.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install">install</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.4" name="faq-35.4">faq-35.4</a><br>
35.4. The Vim help, syntax, indent files are missing from my Vim<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;installation. How do I install these files?<br>
<br>
The Vim help, syntax, indent and other runtime files are part of the Vim<br>
runtime package. You need to download and install the Vim runtime package.<br>
For example, for MS-Windows, the name of the Vim 6.1 runtime package is<br>
vim61rt.zip.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install">install</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.5" name="faq-35.5">faq-35.5</a><br>
35.5. I have built Vim from the source and installed the Vim package using<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;make install&quot;. Do I need to keep the Vim source directory?<br>
<br>
No. Once you have built and installed Vim in some directory other than the<br>
original source directory (for example, /usr/bin or /usr/local/bin), then<br>
you can remove the source directory.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.6" name="faq-35.6">faq-35.6</a><br>
35.6. How do I determine the Vim features which are enabled at compile<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time?<br>
<br>
You can use the &quot;:version&quot; command to determine the Vim features that are<br>
enabled at compile time. The features that are enabled will be prefixed<br>
with a &quot;+&quot;. The features that are not enabled will be prefixed with a &quot;-&quot;.<br>
<br>
If you want to test for a feature in a script, you can use the has()<br>
function:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;if has(&quot;menu&quot;)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot; Set up some menus<br>
&nbsp;&nbsp;&nbsp;&nbsp;endif</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:version">:version</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#+feature-list">+feature-list</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="eval.html#has()">has()</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.7" name="faq-35.7">faq-35.7</a><br>
35.7. Can I build Vim without the GUI support?<br>
<br>
Yes. You can build Vim by optionally enabling/disabling many of the<br>
features including GUI.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_90.html#install">install</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.8" name="faq-35.8">faq-35.8</a><br>
35.8. When building Vim on a Unix system, I am getting &quot;undefined reference<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;to term_set_winsize&quot; error. How do I resolve this error?<br>
<br>
You will get this error when the build process is not able to locate the<br>
termlib, termcap or ncurses library. You have to install the ncurses-dev<br>
package to resolve this error.<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.9" name="faq-35.9">faq-35.9</a><br>
35.9. Vim configure keeps complaining about the lack of gtk-config while<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;trying to use GTK 2.03. This is correct, since in GTK 2 they moved to<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;using the generic pkg-config. I can get pkg-config to list the<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;various includes and libs for gtk, but for some reason the configure<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;script still isn't picking this up.<br>
<br>
Use the following shell script named gtk-config:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;#!/bin/sh<br>
&nbsp;&nbsp;&nbsp;&nbsp;pkg-config gtk+-2.0 $1 $2</div>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-35.10" name="faq-35.10">faq-35.10</a><br>
35.10. I did successfully download the sources and compiled Vim on<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unix. But feature ... still does not work. What is wrong and<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;how can I fix it?<br>
<br>
You should first check, that you are actually running your self compiled<br>
Vim and not the system's provided version. So first check your $PATH<br>
setting.<br>
<br>
Depending on your compile options, some features might not be included in<br>
your build of Vim. You can use the &quot;:version&quot; command to determine the Vim<br>
features that are enabled at compile time. The features that are enabled<br>
will be prefixed with a &quot;+&quot;. The features that are not enabled will be<br>
prefixed with a &quot;-&quot;.<br>
<br>
The easiest way to include all features is to build the huge version. To do<br>
this, you have to specify the --with-features option while running the<br>
configure script:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ ./configure --with-features=huge</div>
<br>
Nevertheless, a feature could still be disabled at compile time, if the<br>
configure script can't find the required libraries for those features (e.g.<br>
for clipboard integration, your Vim needs to be linked against the X11<br>
development libraries).&nbsp;<br>
<br>
There are several ways to install the required libraries:<br>
<br>
1) On a Debian based distribution, you can use the package manager &quot;apt&quot;<br>
&nbsp;&nbsp; to install all required dependencies. As superuser, run the command:<br>
<br>
&nbsp;&nbsp; $ apt-get build-dep vim-gtk<br>
<br>
&nbsp;&nbsp; This makes sure all required libraries needed to compile the vim-gtk<br>
&nbsp;&nbsp; package will be installed. (This requires, that your sources list<br>
&nbsp;&nbsp; contains deb-src entries. See your distribution manual on how to<br>
&nbsp;&nbsp; enable this, if the above command did not work.)<br>
<br>
2) In openSUSE you can use the package manager &quot;zypper&quot; to install all<br>
&nbsp;&nbsp; required libraries. This requires, that there is a source version of<br>
&nbsp;&nbsp; the package installable from a configured repository (which by<br>
&nbsp;&nbsp; default is not the case). Use:<br>
<br>
&nbsp;&nbsp; $ zypper search -t srcpackage vim<br>
<br>
&nbsp;&nbsp; to find out, whether or not there exists a source version in the<br>
&nbsp;&nbsp; repository. If there is none, you'll need to add a source repository.<br>
&nbsp;&nbsp; For openSUSE 11.2 you could use, e.g.<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp; $ zypper ar<br>
&nbsp;&nbsp;&nbsp;<span class="Constant"><a href="http://download.opensuse.org/source/distribution/11.2/repo/oss/src-11.2">http://download.opensuse.org/source/distribution/11.2/repo/oss/src-11.2</a></span><br>
<br>
&nbsp;&nbsp; (one line)<br>
<br>
&nbsp;&nbsp; Once you have a source version available in your repositories, use<br>
&nbsp;&nbsp; this command to install all needed requirements:<br>
<br>
&nbsp;&nbsp; $ zypper source-install --build-deps-only vim<br>
<br>
3) On a Fedora/RedHat based system, you can use<br>
&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp; $ yum-builddep vim-enhanced<br>
<br>
4) Run configure with your options and watch for missing libraries:<br>
&nbsp;&nbsp;<br>
&nbsp;&nbsp; $ ./configure --with-features=huge 2&gt;&amp;1 |tee logfile<br>
<br>
&nbsp;&nbsp; This will run configure and record the output into the file &quot;logfile&quot;.<br>
&nbsp;&nbsp; You need to check the logfile for missing dependencies. Consider this<br>
&nbsp;&nbsp; output:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;checking --disable-gtktest argument... gtk test enabled<br>
&nbsp;&nbsp;&nbsp;&nbsp;checking for pkg-config... /usr/bin/pkg-config<br>
&nbsp;&nbsp;&nbsp;&nbsp;checking for GTK - version &gt;= 2.2.0... no</div>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;Here you can see, that the gtk libraries are missing and therefore<br>
&nbsp;&nbsp;&nbsp;&nbsp;no GTK gui version can't be build. So you need to install the GTK<br>
&nbsp;&nbsp;&nbsp;&nbsp;library in your system, with your package manager or by compiling it<br>
&nbsp;&nbsp;&nbsp;&nbsp;yourself. Then run the configure script again and check, that it<br>
&nbsp;&nbsp;&nbsp;&nbsp;finds the library.<br>
<br>
In theory, those provided dependencies by your distribution might still<br>
lack some libraries, that are needed for features, that simply are not<br>
enabled in your distribution and therefore those commands in 1-3 won't<br>
install it. At the very least, this provides a jumping point and you need<br>
to track down the required missing packages using method 4 from above. But<br>
usually, this works good enough for most people and you won't have to<br>
bother with the fourth method.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:version">:version</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#+feature-list">+feature-list</a><br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36" name="faq-36">faq-36</a><br>
SECTION 36 - VARIOUS<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.1" name="faq-36.1">faq-36.1</a><br>
36.1. How do I edit binary files with Vim?<br>
<br>
You can set the following options to edit binary files in Vim&#0058;<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set binary<br>
&nbsp;&nbsp;&nbsp;&nbsp;:set display=uhex</div>
<br>
You can also use the &quot;-b&quot; command-line option to edit a binary file:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -b &lt;binary_file_name&gt;</div>
<br>
You can also use the xxd utility (part of the Vim distribution) to edit<br>
binary files.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_23.html#23.4">23.4</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="editing.html#edit-binary">edit-binary</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="tips.html#hex-editing">hex-editing</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-b">-b</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'binary'">'binary'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'endofline'">'endofline'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'display'">'display'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.2" name="faq-36.2">faq-36.2</a><br>
36.2. How do I disable the visual error flash and the error beep?<br>
<br>
You can disable both the visual error flash and the error beep using the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set visualbell t_vb=</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'visualbell'">'visualbell'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'errorbells'">'errorbells'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#t_vb">t_vb</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.3" name="faq-36.3">faq-36.3</a><br>
36.3. How do I display the ascii value of a character displayed in a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buffer?<br>
<br>
You can use the&nbsp;<span class="MissingTag">'ga'</span>&nbsp;command to display the ascii value of a displayed<br>
character.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#ga">ga</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="various.html#:ascii">:ascii</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.4" name="faq-36.4">faq-36.4</a><br>
36.4. Can I use zero as a count for a Vim command?<br>
<br>
You cannot use zero as a count for a Vim command, as &quot;0&quot; is a command on<br>
its own, moving to the first column of the line.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="motion.html#0">0</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="intro.html#count">count</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.5" name="faq-36.5">faq-36.5</a><br>
36.5. How do I disable the Vim welcome screen?<br>
<br>
You can disable the Vim welcome screen, by adding the 'I' flag to the<br>
<a class="Type" href="options.html#'shortmess'">'shortmess'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set shortmess+=I</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#:intro">:intro</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'shortmess'">'shortmess'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.6" name="faq-36.6">faq-36.6</a><br>
36.6. How do I avoid the &quot;hit enter to continue&quot; prompt?<br>
<br>
Vim will prompt you with the &quot;hit enter to continue&quot; prompt, if there are<br>
some messages on the screen for you to read and the screen is about to be<br>
redrawn.&nbsp;&nbsp;You can add the 'T' flag to the&nbsp;<a class="Type" href="options.html#'shortmess'">'shortmess'</a>&nbsp;option to truncate<br>
all messages. This will help in avoiding the hit-enter prompt:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set shortmess+=T</div>
<br>
You can also increase the command height by setting the&nbsp;<a class="Type" href="options.html#'cmdheight'">'cmdheight'</a>&nbsp;option:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;:set cmdheight=2</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="message.html#hit-enter">hit-enter</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="version5.html#avoid-hit-enter">avoid-hit-enter</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'shortmess'">'shortmess'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'cmdheight'">'cmdheight'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.7" name="faq-36.7">faq-36.7</a><br>
36.7. How do I invoke Vim from command line to run a group of commands on a<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;group of files?<br>
<br>
There are several ways to invoke Vim from command line to run a group of<br>
commands on a group of files. You can use a set of&nbsp;&nbsp;&quot;-c&quot; command line<br>
options to specify a group of commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -c &quot;&lt;ex_command_1&gt;&quot; -c &quot;&lt;ex_command_2&gt;&quot; *.txt</div>
<br>
Each of the ex-command specified with the &quot;-c&quot; command line option is<br>
executed one by one sequentially. You can also use a single &quot;-c&quot; command<br>
line option and the &quot;|&quot; character to separate the ex commands:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -c &quot;&lt;ex_command_1&gt; | &lt;ex_command_2&gt;&quot; *.txt</div>
<br>
In the above command, if an ex command fails, then all the remaining ex<br>
commands will not be executed.<br>
<br>
For example, to replace &quot;ABC&quot; with &quot;DEF&quot; in a file from the command-line,<br>
you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -c &quot;%s/ABC/DEF/ge | update&quot; myfile.txt</div>
<br>
To replace &quot;ABC&quot; with &quot;DEF&quot; in multiple files from the command-line,<br>
you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -c &quot;argdo %s/ABC/DEF/ge | update&quot; *.txt</div>
<br>
You can store the group of commands into a file and use the &quot;-s&quot; command<br>
line option to run the commands on a set of files. For example, if the<br>
group of commands are stored in the file mycmds.txt, then you can use the<br>
following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim -s mycmds.txt *.pl</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-c">-c</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="starting.html#-s">-s</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.8" name="faq-36.8">faq-36.8</a><br>
36.8. How do I use a normal mode command from insert mode without leaving<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;the insert mode?<br>
<br>
You can use a normal command from insert mode, without leaving the insert<br>
mode, by first pressing the&nbsp;<span class="Special">CTRL-O</span>&nbsp;key and then follow that with a single<br>
normal mode command.<br>
<br>
To execute more than one normal mode command, press the&nbsp;<span class="Special">CTRL-L</span>&nbsp;key,<br>
followed by any number of normal mode commands and then press&nbsp;<span class="Special">&lt;Esc&gt;</span>&nbsp;to get<br>
back to the insert mode. (This only works, when the&nbsp;<a class="Type" href="options.html#'insertmode'">'insertmode'</a>&nbsp;option<br>
is set).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-O">i_CTRL-O</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-L">i_CTRL-L</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.9" name="faq-36.9">faq-36.9</a><br>
36.9. How do I start Vim in insert mode?<br>
<br>
You can start Vim in insert mode using the &quot;:startinsert&quot; ex command.<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim +startinsert myfile.txt</div>
<br>
The above command will open the file &quot;myfile.txt&quot; and start insert mode<br>
with the cursor in front of the first character on the first line.&nbsp;&nbsp;To open<br>
the file and start appending after the last character on the last line,<br>
you can use the following command:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;$ vim + +startinsert! myfile.txt</div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#:startinsert">:startinsert</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.10" name="faq-36.10">faq-36.10</a><br>
36.10. How do I use Copy and Paste with Vim?<br>
<br>
You should first check the output of the &quot;:version&quot; command and make<br>
sure that +xterm-clipboard is present.<br>
<br>
When running Vim in an xterm, you can either let Vim control the mouse<br>
or let xterm control the mouse. This is configured by the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option.<br>
<br>
If the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option is not set (or set to the default value), then Vim will<br>
not control the mouse. You cannot move the Vim text cursor using the<br>
mouse. When you select some text using the mouse, xterm will copy<br>
it to the X11 cut buffer. When you press both the mouse buttons,<br>
xterm will paste the text from the cut buffer.<br>
<br>
If the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option is set to 'a' or some other value, then Vim controls<br>
the mouse. The mode (normal or insert or visual, etc) in which Vim<br>
controls the mouse is configured by the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a>&nbsp;option. You can move<br>
the Vim text cursor using the mouse. When you select some text,<br>
the&nbsp;<a class="Type" href="options.html#'clipboard'">'clipboard'</a>&nbsp;option setting is used to determine whether to transfer<br>
the selected text to the clipboard or not. The default setting is to<br>
transfer the selected text to the clipboard. If you want to use the<br>
xterm selection mechanism in this mode, then you can press the<br>
<span class="Special">&lt;Shift&gt;</span>&nbsp;key. If you press&nbsp;<span class="Special">&lt;Shift&gt;</span>&nbsp;key when selecting text using the<br>
mouse, then Vim doesn't control the mouse and xterm controls the<br>
mouse.<br>
<br>
In the GUI mode, Copy and Paste should just work, depending on the&nbsp;<a class="Type" href="options.html#'mouse'">'mouse'</a><br>
setting. For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'clipboard'">'clipboard'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui_x11.html#x11-selection">x11-selection</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="gui.html#clipboard">clipboard</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'go-a'">'go-a'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'mouse'">'mouse'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="term.html#xterm-copy-paste">xterm-copy-paste</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_09.html#09.3">09.3</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-36.11" name="faq-36.11">faq-36.11</a><br>
36.11. Why shouldn't I modify the files in the system runtime directory?<br>
<br>
Just be careful about modifying files under $VIMRUNTIME, which usually<br>
is /usr/share/vim/vimXX (Unix) or C:\Program Files\vim\vimXX<br>
(Windows) and XX being the version for which it applies, e.g. 73 for Vim<br>
7.3.<br>
<br>
One should generally avoid modifying those files because they may be<br>
replaced during an upgrade of your Vim installation and your changes<br>
will be lost.&nbsp;&nbsp;Also, if you upgrade to a new major or minor revision of<br>
Vim (e.g., from 7.3 to 7.4), the new version of Vim will use a different<br>
$VIMRUNTIME directory and while your changes won't be lost, they will be<br>
ignored.<br>
<br>
Consequently, take a look at&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="filetype.html#filetypes">filetypes</a><br>
<br>
for an explanation of several ways to modify Vim's response to<br>
different filetypes and where to put those modifications so that<br>
they will not be overwritten.<br>
<br>
<span class="PreProc">=============================================================================</span><br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37" name="faq-37">faq-37</a><br>
SECTION 37 - UNICODE<br>
Author: Tony Mechelynck &lt;antoine.mechelynck AT belgacom.net&gt;<br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.1" name="faq-37.1">faq-37.1</a><br>
37.1. Is it possible to create Unicode files using Vim?<br>
<br>
Yes. It may be more or less complicated depending on the keyboard and fonts<br>
available to you, but it is always possible to encode any possible Unicode<br>
codepoint (and some illegal ones) into a file. To create a Unicode file<br>
using Vim, you should have compiled Vim with the &quot;+multi_byte&quot; compile-time<br>
option.&nbsp;&nbsp;You can get more information about Unicode from the following<br>
sites:<br>
<br>
<div class="helpExample">&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.unicode.org">http://www.unicode.org</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.cl.cam.ac.uk/~mgk25/unicode.html">http://www.cl.cam.ac.uk/~mgk25/unicode.html</a></div>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="mbyte.html#multibyte">multibyte</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="usr_45.html">usr_45.txt</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.2" name="faq-37.2">faq-37.2</a><br>
37.2. Which Vim settings are particularly important for editing Unicode<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;files?<br>
<br>
The most important are the various &quot;encoding&quot; options, i.e.,&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>,<br>
<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a>,&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;and&nbsp;<a class="Type" href="options.html#'termencoding'">'termencoding'</a>. The boolean option<br>
<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;is also significant.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'encoding'">'encoding'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileencoding'">'fileencoding'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileencodings'">'fileencodings'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'termencoding'">'termencoding'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'bomb'">'bomb'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.3" name="faq-37.3">faq-37.3</a><br>
37.3. What is the&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;option?<br>
<br>
Basically, the&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;option defines how Vim will represent your data<br>
internally.&nbsp;&nbsp;However, all Unicode encodings are represented internally as<br>
utf-8 and converted (if necessary) when reading and writing.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'encoding'">'encoding'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.4" name="faq-37.4">faq-37.4</a><br>
37.4. How does Vim name the various Unicode encodings?<br>
<br>
Utf-8 is called utf-8 or utf8; utf-16 is called ucs-2 or ucs2; utf-32 is<br>
called ucs-4 or ucs4. Also, you may specify endianness (except for utf-8<br>
which does not vary for endianness) by appending le for little-endian or be<br>
for big-endian. If you create a file with an encoding of ucs-2 or ucs-4<br>
without specifying endianness, Vim will use what is typical of your<br>
machine.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="mbyte.html#encoding-names">encoding-names</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="mbyte.html#encoding-values">encoding-values</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="mbyte.html#encoding-table">encoding-table</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.5" name="faq-37.5">faq-37.5</a><br>
37.5. How does Vim specify the presence or absence of a byte-order mark?<br>
<br>
When reading a file, if the&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;option includes &quot;ucs-bom&quot;, Vim<br>
will check for a byte-order mark. When writing a file, if the&nbsp;<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;option<br>
is set, Vim will write a byte-order mark on files whose encoding warrants<br>
it.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileencodings'">'fileencodings'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'bomb'">'bomb'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.6" name="faq-37.6">faq-37.6</a><br>
37.6. What is the&nbsp;<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a>&nbsp;option?<br>
<br>
The&nbsp;<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a>&nbsp;option defines the particular encoding which Vim will<br>
use to write a file. If empty, then the value of the&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;option is<br>
the default.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileencoding'">'fileencoding'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.7" name="faq-37.7">faq-37.7</a><br>
37.7. What is the&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;option?<br>
<br>
The&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;option defines the heuristics used by Vim when opening<br>
an existing file. It is a comma separated list of encodings. A special<br>
name, &quot;ucs-bom&quot; is used to indicate that Vim should check for the presence<br>
of a byte-order mark; however, it will not be recognised if it comes after<br>
&quot;utf-8&quot;.&nbsp;&nbsp;Normally, &quot;ucs-bom&quot; (if present) should be first in the list.<br>
<br>
When Vim opens a file, it checks it against the encodings listed in<br>
<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>. The first one that matches is used. If there is no match,<br>
then Vim sets&nbsp;<a class="Type" href="options.html#'fileencoding'">'fileencoding'</a>&nbsp;to the null string, i.e., the value of<br>
<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;will be used.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'fileencodings'">'fileencodings'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'encoding'">'encoding'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.8" name="faq-37.8">faq-37.8</a><br>
37.8. What is the&nbsp;<a class="Type" href="options.html#'termencoding'">'termencoding'</a>&nbsp;option?<br>
<br>
The&nbsp;<a class="Type" href="options.html#'termencoding'">'termencoding'</a>&nbsp;option defines how your keyboard encodes the data you<br>
type.&nbsp;&nbsp;If empty, Vim assumes that it has the same value as&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>.<br>
Usually it should be set to something that matches your locale.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'termencoding'">'termencoding'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="mbyte.html#locale">locale</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.9" name="faq-37.9">faq-37.9</a><br>
37.9. What is the&nbsp;<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;option?<br>
<br>
When reading a file with &quot;ucs-bom&quot; present in the&nbsp;<a class="Type" href="options.html#'fileencodings'">'fileencodings'</a>&nbsp;option,<br>
Vim will set the&nbsp;<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;option on or off depending on the presence or<br>
absence of a byte-order mark at the start of the file. When writing, Vim<br>
will write a byte-order mark if the&nbsp;<a class="Type" href="options.html#'bomb'">'bomb'</a>&nbsp;option is set. You may set or<br>
unset it manually do make Vim write, or not write, the b.o.m.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'bomb'">'bomb'</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.10" name="faq-37.10">faq-37.10</a><br>
37.10. Where can I find an example of a typical use of all these options?<br>
<br>
There is a &quot;tip&quot;, with explains them in different words with an example, at<br>
<br>
<span class="Constant"><a href="http://vim.wikia.com/wiki/VimTip246">http://vim.wikia.com/wiki/VimTip246</a></span><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.11" name="faq-37.11">faq-37.11</a><br>
37.11. How can I insert Unicode characters into a file using Vim?<br>
<br>
Several methods are available:<br>
<br>
- Characters present on your keyboard can be typed in the usual way, even<br>
&nbsp;&nbsp;those which require a &quot;dead-key&quot; prefix, like (for instance) the<br>
&nbsp;&nbsp;circumflex on French keyboards.<br>
- Characters for which a digraph is defined can be typed as two characters<br>
&nbsp;&nbsp;prefixed by&nbsp;<span class="Special">&lt;Ctrl-K&gt;</span>.<br>
- If you have set the&nbsp;<a class="Type" href="options.html#'digraph'">'digraph'</a>&nbsp;option, you can enter the characters for<br>
&nbsp;&nbsp;which a digraph is defined as&nbsp;<span class="Special">&lt;char1&gt;&lt;BS&gt;&lt;char2&gt;</span>.<br>
- Any character can be entered by using a&nbsp;<span class="Special">&lt;Ctrl-V&gt;</span>&nbsp;prefix (or&nbsp;<span class="Special">&lt;Ctrl-Q&gt;</span>&nbsp;if<br>
&nbsp;&nbsp;<span class="Special">&lt;Ctrl-V&gt;</span>&nbsp;is remapped to paste from the clipboard).<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#digraphs">digraphs</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'digraph'">'digraph'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="insert.html#i_CTRL-V_digit">i_CTRL-V_digit</a><br>
<br>
<span class="Statement">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><a class="Constant" href="vim_faq.html#faq-37.12" name="faq-37.12">faq-37.12</a><br>
37.12. How can I know which digraphs are defined and for which characters?<br>
<br>
First set the&nbsp;<a class="Type" href="options.html#'encoding'">'encoding'</a>&nbsp;option properly (for instance, to utf-8), then use<br>
the :digraphs command to list the currently defined digraphs.<br>
<br>
Alternatively, the help file contains the complete set of all digraphs.<br>
So you can easily search that list there.<br>
<br>
For more information, read&nbsp;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#:digraphs">:digraphs</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="options.html#'encoding'">'encoding'</a><br>
&nbsp;&nbsp;&nbsp;&nbsp;<a class="Identifier" href="digraph.html#digraph-table">digraph-table</a><br>
<br>
&nbsp;vim:tw=78:ts=8:ft=help:norl:<br>
</div>

</article>

<footer>
<a href="#top">Return to the top</a> - <a href="index.html">Return to main</a>
<span class="EnglishJapaneseLink">
  <span class="CurrentLanguage">English</span>
</span>
<br />
<div style="text-align:right;">
Hosted by <a href="https://github.com/vim-jp/vimdoc-en">vimdoc-en project</a><br />
If you met any problem, please report it to <a href="https://github.com/vim-jp/vimdoc-en/issues">issue</a>.<br />
</div>
</footer>

<!--<script src="js/check-referrer.js" type="text/javascript"></script>-->

</body>
</html>
<!-- vim:set ts=8 sts=2 sw=2 tw=0 et: -->
